[Pkg-javascript-commits] [leaflet-markercluster] 436/479: Clear _spiderfied on a zoomend unspiderfy. Fixes #268

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:01:05 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 a47562c5c66f681883f1d0f9bf63da3c690077b3
Author: danzel <danzel at localhost.geek.nz>
Date:   Thu Oct 31 16:48:32 2013 +1300

    Clear _spiderfied on a zoomend unspiderfy. Fixes #268
---
 spec/suites/spiderfySpec.js     | 22 ++++++++++++++++++++++
 src/MarkerCluster.Spiderfier.js |  2 ++
 2 files changed, 24 insertions(+)

diff --git a/spec/suites/spiderfySpec.js b/spec/suites/spiderfySpec.js
index a6080d5..366bf1a 100644
--- a/spec/suites/spiderfySpec.js
+++ b/spec/suites/spiderfySpec.js
@@ -67,4 +67,26 @@
 		expect(marker._container.parentNode).to.be(map._pathRoot);
 		expect(marker2._container.parentNode).to.be(map._pathRoot);
 	});
+
+	describe('zoomend event listener', function () {
+		it('unspiderfies correctly', function () {
+
+			var group = new L.MarkerClusterGroup();
+			var marker = new L.Circle([1.5, 1.5], 10);
+			var marker2 = new L.Circle([1.5, 1.5], 10);
+
+			group.addLayer(marker);
+			group.addLayer(marker2);
+			map.addLayer(group);
+
+			marker.__parent.spiderfy();
+
+			expect(group._spiderfied).to.not.be(null);
+
+			map.fire('zoomend');
+
+			//We should unspiderfy with no animation, so this should be null
+			expect(group._spiderfied).to.be(null);
+		});
+	});
 });
\ No newline at end of file
diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index 2a1a6f4..ead03b4 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -111,6 +111,8 @@ L.MarkerCluster.include({
 				delete m._spiderLeg;
 			}
 		}
+
+		group._spiderfied = null;
 	}
 });
 

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