Line Dash offset

This commit is contained in:
Thomas Chandelle
2016-11-08 15:38:00 +01:00
parent fd1029600b
commit 7a4ae3a6ac
17 changed files with 150 additions and 15 deletions
+31
View File
@@ -36,6 +36,12 @@ ol.style.Stroke = function(opt_options) {
*/
this.lineDash_ = options.lineDash !== undefined ? options.lineDash : null;
/**
* @private
* @type {number|undefined}
*/
this.lineDashOffset_ = options.lineDashOffset;
/**
* @private
* @type {string|undefined}
@@ -73,6 +79,7 @@ ol.style.Stroke.prototype.clone = function() {
color: (color && color.slice) ? color.slice() : color || undefined,
lineCap: this.getLineCap(),
lineDash: this.getLineDash() ? this.getLineDash().slice() : undefined,
lineDashOffset: this.getLineDashOffset(),
lineJoin: this.getLineJoin(),
miterLimit: this.getMiterLimit(),
width: this.getWidth()
@@ -110,6 +117,16 @@ ol.style.Stroke.prototype.getLineDash = function() {
};
/**
* Get the line dash offset for the stroke.
* @return {number|undefined} Line dash offset.
* @api
*/
ol.style.Stroke.prototype.getLineDashOffset = function() {
return this.lineDashOffset_;
};
/**
* Get the line join type for the stroke.
* @return {string|undefined} Line join.
@@ -182,6 +199,18 @@ ol.style.Stroke.prototype.setLineDash = function(lineDash) {
};
/**
* Set the line dash offset.
*
* @param {number|undefined} lineDashOffset Line dash offset.
* @api
*/
ol.style.Stroke.prototype.setLineDashOffset = function(lineDashOffset) {
this.lineDashOffset_ = lineDashOffset;
this.checksum_ = undefined;
};
/**
* Set the line join.
*
@@ -238,6 +267,8 @@ ol.style.Stroke.prototype.getChecksum = function() {
this.lineCap_.toString() : '-') + ',' +
(this.lineDash_ ?
this.lineDash_.toString() : '-') + ',' +
(this.lineDashOffset_ !== undefined ?
this.lineDashOffset_ : '-') + ',' +
(this.lineJoin_ !== undefined ?
this.lineJoin_ : '-') + ',' +
(this.miterLimit_ !== undefined ?