When initially adding layers, skip layers that are already added. Fixes adding the same layer multiple times before adding the MarkerClusterGroup to the map. Refs #44

This commit is contained in:
danzel
2012-11-09 15:53:21 +13:00
parent e6b67b0b39
commit 17f32ab1f8

View File

@@ -283,7 +283,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
for (var i = 0, l = this._needsClustering.length; i < l; i++) {
this._addLayer(this._needsClustering[i], this._maxZoom);
var layer = this._needsClustering[i];
if (layer.__parent) {
continue;
}
this._addLayer(layer, this._maxZoom);
}
this._needsClustering = [];