[Pkg-javascript-commits] [leaflet-markercluster] 35/219: Fix for new bug on #286
Jonas Smedegaard
dr at jones.dk
Sat May 7 09:39:09 UTC 2016
This is an automated email from the git hooks/post-receive script.
js pushed a commit to branch master
in repository leaflet-markercluster.
commit 339ee4abebdd9641ca52b795144613d426e64d6e
Author: danzel <danzel at localhost.geek.nz>
Date: Tue Apr 15 12:02:10 2014 +1200
Fix for new bug on #286
---
src/MarkerCluster.js | 2 +-
src/MarkerClusterGroup.js | 15 +++++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/MarkerCluster.js b/src/MarkerCluster.js
index a3a7d67..cdca102 100644
--- a/src/MarkerCluster.js
+++ b/src/MarkerCluster.js
@@ -51,7 +51,7 @@ L.MarkerCluster = L.Marker.extend({
mapZoom = map.getZoom(),
i;
- //calculate how fare we need to zoom down to see all of the markers
+ //calculate how far we need to zoom down to see all of the markers
while (childClusters.length > 0 && boundsZoom > zoom) {
zoom++;
var newClusters = [];
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index 4b77fbf..da15105 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -423,16 +423,27 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
};
if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) {
+ //Layer is visible ond on screen, immediate return
callback();
} else if (layer.__parent._zoom < this._map.getZoom()) {
- //Layer should be visible now but isn't on screen, just pan over to it
+ //Layer should be visible at this zoom level. It must not be on screen so just pan over to it
this._map.on('moveend', showMarker, this);
this._map.panTo(layer.getLatLng());
} else {
+ var moveStart = function () {
+ this._map.off('movestart', moveStart, this);
+ moveStart = null;
+ };
+
+ this._map.on('movestart', moveStart, this);
this._map.on('moveend', showMarker, this);
this.on('animationend', showMarker, this);
- this._map.setView(layer.getLatLng(), layer.__parent._zoom + 1);
layer.__parent.zoomToBounds();
+
+ if (moveStart) {
+ //Never started moving, must already be there, probably need clustering however
+ showMarker.call(this);
+ }
}
},
--
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