Merge pull request #4698 from fredj/regular_shape_rotate_with_view
Add rotateWithView option to ol.style.RegularShape
This commit is contained in:
@@ -6266,6 +6266,7 @@ olx.style.IconOptions.prototype.src;
|
||||
* snapToPixel: (boolean|undefined),
|
||||
* stroke: (ol.style.Stroke|undefined),
|
||||
* rotation: (number|undefined),
|
||||
* rotateWithView: (boolean|undefined),
|
||||
* atlasManager: (ol.style.AtlasManager|undefined)}}
|
||||
* @api
|
||||
*/
|
||||
@@ -6353,6 +6354,14 @@ olx.style.RegularShapeOptions.prototype.stroke;
|
||||
olx.style.RegularShapeOptions.prototype.rotation;
|
||||
|
||||
|
||||
/**
|
||||
* Whether to rotate the shape with the view. Default is `false`.
|
||||
* @type {boolean|undefined}
|
||||
* @api
|
||||
*/
|
||||
olx.style.RegularShapeOptions.prototype.rotateWithView;
|
||||
|
||||
|
||||
/**
|
||||
* The atlas manager to use for this symbol. When using WebGL it is
|
||||
* recommended to use an atlas manager to avoid texture switching.
|
||||
|
||||
@@ -123,9 +123,15 @@ ol.style.RegularShape = function(options) {
|
||||
var snapToPixel = options.snapToPixel !== undefined ?
|
||||
options.snapToPixel : true;
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
var rotateWithView = options.rotateWithView !== undefined ?
|
||||
options.rotateWithView : false;
|
||||
|
||||
goog.base(this, {
|
||||
opacity: 1,
|
||||
rotateWithView: false,
|
||||
rotateWithView: rotateWithView,
|
||||
rotation: options.rotation !== undefined ? options.rotation : 0,
|
||||
scale: 1,
|
||||
snapToPixel: snapToPixel
|
||||
|
||||
@@ -4,6 +4,14 @@ describe('ol.style.RegularShape', function() {
|
||||
|
||||
describe('#constructor', function() {
|
||||
|
||||
it('can use rotateWithView', function() {
|
||||
var style = new ol.style.RegularShape({
|
||||
rotateWithView: true,
|
||||
radius: 0
|
||||
});
|
||||
expect(style.getRotateWithView()).to.be(true);
|
||||
});
|
||||
|
||||
it('can use radius', function() {
|
||||
var style = new ol.style.RegularShape({
|
||||
radius: 5,
|
||||
|
||||
Reference in New Issue
Block a user