[Pkg-javascript-commits] [leaflet-markercluster] 278/479: Fix issue #79.

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:39 UTC 2014


This is an automated email from the git hooks/post-receive script.

js pushed a commit to branch master
in repository leaflet-markercluster.

commit 5719cb94ffc0001eab2e2a7fa149c566e46b9da3
Author: Duncan Parkes <duncan at mysociety.org>
Date:   Wed Oct 17 12:08:22 2012 +0100

    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
---
 dist/leaflet.markercluster-src.js | 10 +++++++---
 src/MarkerClusterGroup.js         | 10 +++++++---
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/dist/leaflet.markercluster-src.js b/dist/leaflet.markercluster-src.js
index 2c4a3e6..0f02a59 100644
--- a/dist/leaflet.markercluster-src.js
+++ b/dist/leaflet.markercluster-src.js
@@ -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;
 	},
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index c4affab..f92745d 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -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;
 	},

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/leaflet-markercluster.git



More information about the Pkg-javascript-commits mailing list