Merge pull request #415 from rdenniston/master

made a minor change to _zoomOrSpiderfy to Spiderfy without zooming
This commit is contained in:
Dave Leaver
2014-11-02 15:17:30 +13:00
2 changed files with 7 additions and 3 deletions
+2 -2
View File
@@ -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
+5 -1
View File
@@ -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();
}