From 6766b1a875d03e7ca99f1a11e2231b649f44afcf Mon Sep 17 00:00:00 2001 From: danzel Date: Thu, 19 Jul 2012 13:23:47 +1200 Subject: [PATCH] Removing commented out bits etc --- src/MarkerCluster.js | 2 ++ src/MarkerClusterGroup.js | 35 ++--------------------------------- 2 files changed, 4 insertions(+), 33 deletions(-) diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js index a5037ac25..b67610afe 100644 --- a/src/MarkerCluster.js +++ b/src/MarkerCluster.js @@ -295,6 +295,8 @@ L.MarkerCluster = L.Marker.extend({ var childClusters = this._childClusters, i, c; + //TODO: When zooming down we need to generate new clusters for levels that don't have them yet + if (depthToStartAt > 0) { //Still going down to required depth, just recurse to child clusters for (i = childClusters.length - 1; i >= 0; i--) { c = childClusters[i]; diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js index 910db6d1f..754ec84d4 100644 --- a/src/MarkerClusterGroup.js +++ b/src/MarkerClusterGroup.js @@ -421,25 +421,10 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? { depthToAnimateIn = previousZoomLevel - newZoomLevel; console.log('animationZoomOut ' + depthToStartAt + ' ' + depthToAnimateIn); + //Animate all of the markers in the clusters to move to their cluster center point - //bounds, depthToStartAt, depthToAnimateIn this._topClusterLevel._recursivelyAnimateChildrenInAndAddSelfToMap(bounds, depthToStartAt, depthToAnimateIn); - /*for ( i = 0; i < newClusters.length; i++) { - var c = newClusters[i]; - c._recursivelyAnimateChildrenIn(this._map.latLngToLayerPoint(c.getLatLng()).round(), depth); - - if (bounds.contains(c._latlng)) { //Add the new cluster but have it be hidden (so it gets animated, display=none stops transition) - - if (c._isSingleParent()) { //If we are the same as our parent, don't do an animation, just immediately appear - c.setOpacity(1); - c._recursivelyRemoveChildrenFromMap(depth); - } else { - c.setOpacity(0); - } - c._addToMap(); - } - }*/ this._inZoomAnimation++; var me = this; @@ -447,30 +432,14 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? { //Immediately fire an event to update the opacity (If we immediately set it they won't animate) setTimeout(function () { me._topClusterLevel._recursivelyBecomeVisible(bounds, depthToStartAt); - /*for (i = 0; i < newClusters.length; i++) { - var n = newClusters[i]; - - if (n._icon) { - n.setOpacity(1); - } - }*/ }, 0); //TODO: Maybe use the transition timing stuff to make this more reliable + //When the animations are done, tidy up setTimeout(function () { map._mapPane.className = map._mapPane.className.replace(' leaflet-cluster-anim', ''); me._topClusterLevel._recursivelyRemoveChildrenAndAddNowVisibleMarkers(bounds, depthToStartAt, depthToAnimateIn); - /*for (i = 0; i < newClusters.length; i++) { - var cl = newClusters[i]; - cl._recursivelyRemoveChildrenFromMap(depth); - } - for (i = newUnclustered.length - 1; i >= 0; i--) { - var m = newUnclustered[i]; - if (bounds.contains(m._latlng)) { - L.FeatureGroup.prototype.addLayer.call(me, m); - } - }*/ me._inZoomAnimation--; }, 250); }