Little bit of tidy up, refs #298

This commit is contained in:
danzel
2014-01-20 10:37:57 +13:00
parent 2b224523d3
commit e78b61d1ca
+6 -8
View File
@@ -694,17 +694,15 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
},
_generateInitialClusters: function () {
var maxZoom = this._map.getMaxZoom(),
var maxZoom = this._map.getMaxZoom(),
radius = this.options.maxClusterRadius,
radiusFunction = null;
radiusFn = radius;
//If we just set maxClusterRadius to a single number, we need to create
//a simple function to return that number. Otherwise, we just have to
//use the function we've passed in.
if (typeof radius === "number") {
radiusFunction = function () { return radius; };
} else if (typeof radius === "function") {
radiusFunction = radius;
if (typeof radius !== "function") {
radiusFn = function () { return radius; };
}
if (this.options.disableClusteringAtZoom) {
@@ -716,8 +714,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//Set up DistanceGrids for each zoom
for (var zoom = maxZoom; zoom >= 0; zoom--) {
this._gridClusters[zoom] = new L.DistanceGrid(radiusFunction(zoom));
this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFunction(zoom));
this._gridClusters[zoom] = new L.DistanceGrid(radiusFn(zoom));
this._gridUnclustered[zoom] = new L.DistanceGrid(radiusFn(zoom));
}
this._topClusterLevel = new L.MarkerCluster(this, -1);