Add clone methods to styles

This commit is contained in:
simonseyock
2016-09-01 16:19:56 +01:00
committed by Simon Seyock
parent f61a43b3c6
commit c561f1587b
7 changed files with 163 additions and 5 deletions
+17
View File
@@ -62,6 +62,23 @@ ol.style.Stroke = function(opt_options) {
};
/**
* Clones the style.
* @return {ol.style.Stroke} The cloned style.
* @api
*/
ol.style.Stroke.prototype.clone = function() {
return new ol.style.Stroke({
color: (this.getColor() instanceof Array) ? this.getColor().slice(0) : this.getColor(),
lineCap: this.getLineCap(),
lineDash: this.getLineDash() ? this.getLineDash().slice(0) : undefined,
lineJoin: this.getLineJoin(),
miterLimit: this.getMiterLimit(),
width: this.getWidth()
});
};
/**
* Get the stroke color.
* @return {ol.Color|string} Color.