Merge pull request #4698 from fredj/regular_shape_rotate_with_view

Add rotateWithView option to ol.style.RegularShape
This commit is contained in:
Frédéric Junod
2016-01-21 11:20:04 +01:00
3 changed files with 24 additions and 1 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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,