[Pkg-javascript-commits] [leaflet-markercluster] 26/479: Fade markers in during a zoom in.
Jonas Smedegaard
dr at jones.dk
Thu Oct 16 16:00:05 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 8f97ecf963d8bd271d3cc5255eb3261693516bc6
Author: danzel <danzel at localhost.geek.nz>
Date: Tue Jul 17 14:43:44 2012 +1200
Fade markers in during a zoom in.
---
src/MarkerCluster.js | 2 +-
src/MarkerClusterGroup.js | 14 +++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index 627933d..c41c5af 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -161,9 +161,9 @@ L.MarkerCluster = L.Marker.extend({
nm._backupLatlng = nm.getLatLng();
nm.setLatLng(startPos);
+ nm.setOpacity(0);
}
-
L.FeatureGroup.prototype.addLayer.call(this._group, nm);
}
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 91fd1d4..14d8e00 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -444,6 +444,16 @@ 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 () {
+ for (i in me._layers) {
+ var n = me._layers[i];
+
+ if (!(n instanceof L.MarkerCluster) && n._icon) {
+ n.setOpacity(1);
+ }
+ }
+ }, 0);
this._inZoomAnimation++;
//Start up a function to update the positions of the just added clusters/markers
@@ -480,7 +490,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
var me = this;
- //TODO: Maybe use the transition timing stuff to make this more reliable
+ //Immediately fire an event to update the opacity (If we immediately set it they won't animate)
setTimeout(function () {
for (i = 0; i < newClusters.length; i++) {
var n = newClusters[i];
@@ -490,6 +500,8 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
}
}
}, 0);
+
+ //TODO: Maybe use the transition timing stuff to make this more reliable
setTimeout(function () {
map._mapPane.className = map._mapPane.className.replace(' leaflet-cluster-anim', '');
--
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