Fix issue #79.

When a MarkerClusterGroup has been on a map, but isn't any longer,
we still need to clear out its markers.
(cherry picked from commit 2a90a86326aee1afd0392efd019d9cdb3f6dd0d0)

Conflicts:

	dist/leaflet.markercluster.js
This commit is contained in:
Duncan Parkes
2012-10-19 10:14:31 +13:00
committed by danzel
parent 1f09009349
commit 5719cb94ff
2 changed files with 14 additions and 6 deletions
+7 -3
View File
@@ -190,7 +190,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//If we aren't on the map yet, just blow away the markers we know of
if (!this._map) {
this._needsClustering = [];
return this;
this._gridClusters = undefined;
this._gridUnclustered = undefined;
// return this;
}
if (this._unspiderfy) {
@@ -204,8 +206,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
}
//Reset _topClusterLevel and the DistanceGrids
this._generateInitialClusters();
if (this._map) {
//Reset _topClusterLevel and the DistanceGrids
this._generateInitialClusters();
}
return this;
},
+7 -3
View File
@@ -183,7 +183,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
//If we aren't on the map yet, just blow away the markers we know of
if (!this._map) {
this._needsClustering = [];
return this;
this._gridClusters = undefined;
this._gridUnclustered = undefined;
// return this;
}
if (this._unspiderfy) {
@@ -197,8 +199,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
}
}
//Reset _topClusterLevel and the DistanceGrids
this._generateInitialClusters();
if (this._map) {
//Reset _topClusterLevel and the DistanceGrids
this._generateInitialClusters();
}
return this;
},