[Pkg-javascript-commits] [leaflet-markercluster] 181/479: Fix a crash that can happen if you remove the layer from the map while a zoom animation is going on. Fixes #36

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:27 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 02a869bf60d60a3e0b43349a35d8756b6094e345
Author: danzel <danzel at localhost.geek.nz>
Date:   Mon Aug 27 13:32:36 2012 +1200

    Fix a crash that can happen if you remove the layer from the map while a zoom animation is going on. Fixes #36
---
 src/MarkerClusterGroup.js | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 37a2f77..6601a6a 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -127,6 +127,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 		this._map.off('zoomend', this._zoomEnd, this);
 		this._map.off('moveend', this._moveEnd, this);
 
+		//In case we are in a cluster animation
+		this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '');
+
 		if (this._spiderfierOnRemove) { //TODO FIXME: Not sure how to have spiderfier add something on here nicely
 			this._spiderfierOnRemove();
 		}
@@ -420,7 +423,9 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
 		this._inZoomAnimation++;
 	},
 	_animationEnd: function () {
-		this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '');
+		if (this._map) {
+			this._map._mapPane.className = this._map._mapPane.className.replace(' leaflet-cluster-anim', '');
+		}
 		this._inZoomAnimation--;
 	},
 	_animationZoomIn: function (previousZoomLevel, newZoomLevel) {

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