Add ol.source.Cluster#getDistance function

This commit is contained in:
Frederic Junod
2017-04-13 11:27:21 +02:00
parent 8b0e1b638b
commit de057ac505
2 changed files with 13 additions and 3 deletions

View File

@@ -74,6 +74,16 @@ ol.source.Cluster = function(options) {
ol.inherits(ol.source.Cluster, ol.source.Vector);
/**
* Get the distance in pixels between clusters.
* @return {number} Distance.
* @api
*/
ol.source.Cluster.prototype.getDistance = function() {
return this.distance_;
};
/**
* Get a reference to the wrapped source.
* @return {ol.source.Vector} Source.

View File

@@ -19,7 +19,7 @@ describe('ol.source.Cluster', function() {
});
expect(source).to.be.a(ol.source.Source);
expect(source).to.be.a(ol.source.Cluster);
expect(source.distance_).to.be(20);
expect(source.getDistance()).to.be(20);
});
});
@@ -71,9 +71,9 @@ describe('ol.source.Cluster', function() {
distance: 100,
source: new ol.source.Vector()
});
expect(source.distance_).to.be(100);
expect(source.getDistance()).to.be(100);
source.setDistance(10);
expect(source.distance_).to.be(10);
expect(source.getDistance()).to.be(10);
});
});