Offset for ImageStyle

This commit is contained in:
jkonieczny
2019-12-18 08:22:40 +01:00
committed by Andreas Hocevar
parent ee1b038714
commit 4c7f52c8a4
4 changed files with 28 additions and 27 deletions

View File

@@ -10,6 +10,7 @@ import {abstract} from '../util.js';
* @property {boolean} rotateWithView
* @property {number} rotation
* @property {number} scale
* @property {Array<number>} offset
*/
@@ -51,6 +52,12 @@ class ImageStyle {
*/
this.scale_ = options.scale;
/**
* @private
* @type {Array<number>}
*/
this.offset_ = options.offset;
}
/**
@@ -63,7 +70,8 @@ class ImageStyle {
opacity: this.getOpacity(),
scale: this.getScale(),
rotation: this.getRotation(),
rotateWithView: this.getRotateWithView()
rotateWithView: this.getRotateWithView(),
offset: this.getOffset().slice()
});
}
@@ -103,6 +111,15 @@ class ImageStyle {
return this.scale_;
}
/**
* Get the offset of the shape
* @return {Array<number>} Shape's center offset
* @api
*/
getOffset() {
return this.offset_;
}
/**
* Get the anchor point in pixels. The anchor determines the center point for the
* symbolizer.