[Pkg-javascript-commits] [leaflet-markercluster] 148/479: Fix #27 for touch zoom

Jonas Smedegaard dr at jones.dk
Thu Oct 16 16:00:23 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 7254719ac6b4e6ca0b22a5c41516b081c8fddcc8
Author: danzel <danzel at localhost.geek.nz>
Date:   Tue Aug 7 11:31:39 2012 +1200

    Fix #27 for touch zoom
---
 src/MarkerCluster.Spiderfier.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/MarkerCluster.Spiderfier.js b/src/MarkerCluster.Spiderfier.js
index be6f6af..21209d0 100644
--- a/src/MarkerCluster.Spiderfier.js
+++ b/src/MarkerCluster.Spiderfier.js
@@ -309,10 +309,11 @@ L.MarkerClusterGroup.include({
 		this._map.on('click', this._unspiderfyWrapper, this);
 		this._map.on('zoomstart', this._unspiderfyZoomStart, this);
 
-		if (L.Browser.svg) {
-			this._map._initPathRoot(); //Needs to happen in the pageload, not after, or animations don't work in chrome
+		if (L.Browser.svg && !L.Browser.touch) {
+			this._map._initPathRoot();
+			//Needs to happen in the pageload, not after, or animations don't work in webkit
 			//  http://stackoverflow.com/questions/8455200/svg-animate-with-dynamically-added-elements
-
+			//Disable on touch browsers as the animation messes up on a touch zoom and isn't very noticable
 		}
 	},
 
@@ -328,6 +329,11 @@ L.MarkerClusterGroup.include({
 		this._map.on('zoomanim', this._unspiderfyZoomAnim, this);
 	},
 	_unspiderfyZoomAnim: function (zoomDetails) {
+		//Wait until the first zoomanim after the user has finished touch-zooming before running the animation
+		if (L.DomUtil.hasClass(this._map._mapPane, 'leaflet-touching')) {
+			return;
+		}
+
 		this._map.off('zoomanim', this._unspiderfyZoomAnim, this);
 		this._unspiderfy(zoomDetails);
 	},

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