[Pkg-javascript-commits] [leaflet-markercluster] 208/479: Fix and test for #49, clearLayers wasn't unspiderfying.

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:30 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 fb165b18b1768b7e6267895079d20f5d46632ef6
Author: danzel <danzel at localhost.geek.nz>
Date:   Fri Sep 7 14:10:05 2012 +1200

    Fix and test for #49, clearLayers wasn't unspiderfying.
---
 example/old-bugs/remove-when-spiderfied.html | 7 ++++++-
 src/MarkerClusterGroup.js                    | 4 ++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/example/old-bugs/remove-when-spiderfied.html b/example/old-bugs/remove-when-spiderfied.html
index c72155d..6c674b5 100644
--- a/example/old-bugs/remove-when-spiderfied.html
+++ b/example/old-bugs/remove-when-spiderfied.html
@@ -21,9 +21,11 @@
 <body>
 
 	<div id="map"></div>
-	<button id="doit">Remove and add direct to map</button><br/>
+	<button id="doit">Remove and add direct to map</button><button id="doit2">clearLayers</button><br/>
 	<span>Bug <a href="https://github.com/danzel/Leaflet.markercluster/issues/54">#54</a>. Spiderfy the cluster then click the button. Should result in 2 markers right beside each other on the map.</span><br/>
 	<span>Bug <a href="https://github.com/danzel/Leaflet.markercluster/issues/53">#53</a>. Spiderfy the cluster then click the button. Spider lines remain on the map.</span>
+	<span>Bug <a href="https://github.com/danzel/Leaflet.markercluster/issues/49">#49</a>. Spiderfy the cluster then click the second button. Spider lines remain on the map. Click the map to get an error.</span>
+
 	<script type="text/javascript">
 
 		var cloudmadeUrl = 'http://{s}.tile.cloudmade.com/BC9A493B41014CAABB98F0471D759707/997/256/{z}/{x}/{y}.png',
@@ -52,6 +54,9 @@
 			map.addLayer(markersList[0]);
 			map.addLayer(markersList[1]);
 		};
+		L.DomUtil.get('doit2').onclick = function () {
+			markers.clearLayers();
+		};
 
 	</script>
 </body>
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 702abfd..a1a2b15 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -103,6 +103,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 	clearLayers: function () {
 		//Need our own special implementation as the LayerGroup one doesn't work for us
 
+		if (this._unspiderfy) {
+			this._unspiderfy();
+		}
+
 		//If we aren't on the map yet, just blow away the markers we know of
 		if (!this._map) {
 			this._needsClustering = [];

-- 
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