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
+22
View File
@@ -95,6 +95,28 @@ ol.style.Text = function(opt_options) {
ol.style.Text.DEFAULT_FILL_COLOR_ = '#333';
/**
* Clones the style.
* @return {ol.style.Text} The cloned style.
* @api
*/
ol.style.Text.prototype.clone = function() {
return new ol.style.Text({
font: this.getFont(),
rotation: this.getRotation(),
rotateWithView: this.getRotateWithView(),
scale: this.getScale(),
text: this.getText(),
textAlign: this.getTextAlign(),
textBaseline: this.getTextBaseline(),
fill: this.getFill() ? this.getFill().clone() : undefined,
stroke: this.getStroke() ? this.getStroke().clone() : undefined,
offsetX: this.getOffsetX(),
offsetY: this.getOffsetY()
});
};
/**
* Get the font name.
* @return {string|undefined} Font.