[Pkg-javascript-commits] [leaflet-markercluster] 183/219: Simplified spiderfy at current zoom trigger
Jonas Smedegaard
dr at jones.dk
Sat May 7 09:39:33 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 8bb5e64a6804f1c43b05f471ecf165be00cdc396
Author: ghybs <ghybs1 at gmail.com>
Date: Wed Nov 25 17:09:48 2015 +0400
Simplified spiderfy at current zoom trigger
Crawl down child clusters instead of requesting all child markers to pick the first one, as requesting all child markers crawls down all child clusters recursively...
---
src/MarkerClusterGroup.js | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js
index a2e5cd4..6fee067 100644
--- a/src/MarkerClusterGroup.js
+++ b/src/MarkerClusterGroup.js
@@ -711,9 +711,13 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
_zoomOrSpiderfy: function (e) {
var map = this._map,
cluster = e.layer,
- someChildMarkerParent = cluster.getAllChildMarkers()[0].__parent;
+ bottomCluster = cluster;
- if (someChildMarkerParent._zoom === map.getMaxZoom() && someChildMarkerParent._childCount === cluster._childCount) {
+ while (bottomCluster._childClusters.length) {
+ bottomCluster = bottomCluster._childClusters[0];
+ } // bottomCluster is not necessarily the bottom-most one, but in that case we should not spiderfy anyway.
+
+ if (bottomCluster._zoom === map.getMaxZoom() && bottomCluster._childCount === cluster._childCount) {
// All child markers are contained in a single cluster from map._maxZoom to this cluster.
if (this.options.spiderfyOnMaxZoom) {
cluster.spiderfy();
--
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