Add ol.style.Circle#setRadius
This commit is contained in:
+18
-6
@@ -23,6 +23,12 @@ ol.style.Circle = function(opt_options) {
|
|||||||
|
|
||||||
var options = opt_options || {};
|
var options = opt_options || {};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
* @type {ol.style.AtlasManager|undefined}
|
||||||
|
*/
|
||||||
|
this.atlasManager_ = options.atlasManager;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {Array.<string>}
|
* @type {Array.<string>}
|
||||||
@@ -89,12 +95,6 @@ ol.style.Circle = function(opt_options) {
|
|||||||
*/
|
*/
|
||||||
this.hitDetectionImageSize_ = null;
|
this.hitDetectionImageSize_ = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {ol.style.AtlasManager|undefined}
|
|
||||||
*/
|
|
||||||
this.atlasManager_ = options.atlasManager;
|
|
||||||
|
|
||||||
this.render_(this.atlasManager_);
|
this.render_(this.atlasManager_);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -231,6 +231,18 @@ ol.style.Circle.prototype.getStroke = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the circle radius.
|
||||||
|
*
|
||||||
|
* @param {number} radius Circle radius.
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
ol.style.Circle.prototype.setRadius = function(radius) {
|
||||||
|
this.radius_ = radius;
|
||||||
|
this.render_(this.atlasManager_);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -285,4 +285,19 @@ describe('ol.style.Circle', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('#setRadius', function() {
|
||||||
|
it('changes the circle radius', function() {
|
||||||
|
var style = new ol.style.Circle({
|
||||||
|
radius: 10,
|
||||||
|
fill: new ol.style.Fill({
|
||||||
|
color: '#FFFF00'
|
||||||
|
})
|
||||||
|
});
|
||||||
|
expect(style.getRadius()).to.eql(10);
|
||||||
|
style.setRadius(20);
|
||||||
|
expect(style.getRadius()).to.eql(20);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user