diff --git a/README.md b/README.md index f762995d3f..cfc1919399 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ map.addLayer(markers); By default the Clusterer enables some nice defaults for you: * **showCoverageOnHover**: When you mouse over a cluster it shows the bounds of its markers. * **zoomToBoundsOnClick**: When you click a cluster we zoom to its bounds. -* **spiderfyOnMaxZoom**: When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers. +* **spiderfyOnMaxZoom**: When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers. (*Note: the spiderfy occurs at the current zoom level if all items within the cluster are physically located at the same latitude and longitude.*) * **removeOutsideVisibleBounds**: Clusters and markers too far from the viewport are removed from the map for performance. You can disable any of these as you want in the options when you create the MarkerClusterGroup: @@ -58,7 +58,7 @@ Check out the [custom example](http://leaflet.github.com/Leaflet.markercluster/e Enabled by default (boolean options): * **showCoverageOnHover**: When you mouse over a cluster it shows the bounds of its markers. * **zoomToBoundsOnClick**: When you click a cluster we zoom to its bounds. -* **spiderfyOnMaxZoom**: When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers. +* **spiderfyOnMaxZoom**: When you click a cluster at the bottom zoom level we spiderfy it so you can see all of its markers. (*Note: the spiderfy occurs at the current zoom level if all items within the cluster are physically located at the same latitude and longitude.*) * **removeOutsideVisibleBounds**: Clusters and markers too far from the viewport are removed from the map for performance. Other options diff --git a/src/MarkerClusterGroup.js b/src/MarkerClusterGroup.js index 03e42750da..d6b408fe52 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(); }