diff --git a/examples/regularshape.js b/examples/regularshape.js index 141f07280b..195054b8e2 100644 --- a/examples/regularshape.js +++ b/examples/regularshape.js @@ -31,6 +31,7 @@ var styles = { stroke: stroke, points: 3, radius: 10, + rotation: Math.PI / 4, angle: 0 })) })], diff --git a/externs/olx.js b/externs/olx.js index 6872d4d8a7..d58a126bb3 100644 --- a/externs/olx.js +++ b/externs/olx.js @@ -5709,6 +5709,7 @@ olx.style.IconOptions.prototype.src; * angle: (number|undefined), * snapToPixel: (boolean|undefined), * stroke: (ol.style.Stroke|undefined), + * rotation: (number|undefined), * atlasManager: (ol.style.AtlasManager|undefined)}} * @api */ @@ -5757,7 +5758,7 @@ olx.style.RegularShapeOptions.prototype.radius2; /** - * Shape's rotation in radians. A value of 0 will have one of the shape's point + * Shape's angle in radians. A value of 0 will have one of the shape's point * facing up. * Default value is 0. * @type {number|undefined} @@ -5788,6 +5789,14 @@ olx.style.RegularShapeOptions.prototype.snapToPixel; olx.style.RegularShapeOptions.prototype.stroke; +/** + * Rotation in radians (positive rotation clockwise). Default is `0`. + * @type {number|undefined} + * @api + */ +olx.style.RegularShapeOptions.prototype.rotation; + + /** * The atlas manager to use for this symbol. When using WebGL it is * recommended to use an atlas manager to avoid texture switching. diff --git a/src/ol/style/regularshapestyle.js b/src/ol/style/regularshapestyle.js index 54b8362755..bf50f3bad3 100644 --- a/src/ol/style/regularshapestyle.js +++ b/src/ol/style/regularshapestyle.js @@ -133,7 +133,7 @@ ol.style.RegularShape = function(options) { goog.base(this, { opacity: 1, rotateWithView: false, - rotation: 0, + rotation: goog.isDef(options.rotation) ? options.rotation : 0, scale: 1, snapToPixel: snapToPixel });