[Pkg-javascript-commits] [leaflet-markercluster] 70/128: Get zoom from internal _zoom instead of map.getZoom()

Jonas Smedegaard dr at jones.dk
Sun Apr 16 06:26:04 UTC 2017


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

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

commit f87592144c6c155cc3385a46f419f9d4effb5c6a
Author: ghybs <ghybs1 at gmail.com>
Date:   Fri Aug 26 10:11:58 2016 +0400

    Get zoom from internal _zoom instead of map.getZoom()
    
    in addLayer and _animationAddLayer methods, for compatibility with MCG.Freezable plugin (see issue https://github.com/ghybs/Leaflet.MarkerCluster.Freezable/issues/1).
    In normal situation (i.e. without Freezable plugin), the 2 should differ only momentarily at the end of a zoom, before the _zoomEnd listener is called, and until that listener completes. If addLayer happens before the listener is called, it should perform as if the zoom did not occur yet, then _zoomEnd proceeds with the new layer / cluster without issue. addLayer should not be able to execute in the middle of _zoomEnd, as there is no asynchronous task involved, except for the end of t [...]
    When Freezable plugin is added, it tampers _zoom and listeners to disable changes and animations. So we should no longer call map.getZoom() / map._zoom outside the disabled listeners.
---
 src/MarkerClusterGroup.js | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 07e0ef8..1363ecd 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -108,7 +108,7 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
 
 		//Work out what is visible
 		var visibleLayer = layer,
-			currentZoom = this._map.getZoom();
+		    currentZoom = this._zoom;
 		if (layer.__parent) {
 			while (visibleLayer.__parent._zoom >= currentZoom) {
 				visibleLayer = visibleLayer.__parent;
@@ -1251,7 +1251,7 @@ L.MarkerClusterGroup.include({
 					this._forceLayout();
 
 					me._animationStart();
-					me._animationZoomOutSingle(newCluster, this._map.getMaxZoom(), this._map.getZoom());
+					me._animationZoomOutSingle(newCluster, this._map.getMaxZoom(), this._zoom);
 				}
 			}
 		}

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