From ab3cdd49a1d0b23eef97f2087656210886aa5552 Mon Sep 17 00:00:00 2001 From: "Ryan \"rman\" Denniston" Date: Fri, 31 Oct 2014 23:28:32 -1000 Subject: [PATCH] made a minor change to _zoomOrSpiderfy to Spiderfy without zooming if everything in the cluster is at the same lat long. This prevents zooming into max level if there is no real reason to do so, since all points will be at the same location. This minor change increased usability in a personal project. --- src/MarkerClusterGroup.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js index 03e42750d..58794c3a3 100644 --- a/src/MarkerClusterGroup.js +++ b/src/MarkerClusterGroup.js @@ -655,7 +655,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({ _zoomOrSpiderfy: function (e) { var map = this._map; - if (map.getMaxZoom() === map.getZoom()) { + if (e.layer._bounds._northEast.equals(e.layer._bounds._southWest)){ + if (this.options.spiderfyOnMaxZoom) { + e.layer.spiderfy(); + } + }else if (map.getMaxZoom() === map.getZoom()) { if (this.options.spiderfyOnMaxZoom) { e.layer.spiderfy(); }