From d29edf7e73fec32e00eab80d02618f9fb23991f9 Mon Sep 17 00:00:00 2001 From: danzel Date: Tue, 17 Jul 2012 15:09:34 +1200 Subject: [PATCH] Fade out old clusters on zoom in --- src/MarkerClusterGroup.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js index 14d8e0062..4b1846665 100644 --- a/src/MarkerClusterGroup.js +++ b/src/MarkerClusterGroup.js @@ -430,9 +430,8 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? { c = startingClusters[i]; startPos = c.getLatLng(); - //Remove old cluster - L.FeatureGroup.prototype.removeLayer.call(this, c); //TODO Animate - + //Fade out old cluster + c.setOpacity(0); c._recursivelyAddChildrenToMap(startPos, depth, bounds); } @@ -465,6 +464,9 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? { } setTimeout(function () { + for (i = 0; i < startingClusters.length; i++) { + L.FeatureGroup.prototype.removeLayer.call(me, startingClusters[i]); + } map._mapPane.className = map._mapPane.className.replace(' leaflet-cluster-anim', ''); me._inZoomAnimation--; }, 250);