Add options.disableClusteringAtZoom. Only implemented for initial clustering currently

This commit is contained in:
danzel
2012-08-20 10:00:31 +12:00
parent 3e69cab1f2
commit 0b6b7ed560
2 changed files with 11 additions and 1 deletions
+4
View File
@@ -45,6 +45,10 @@ var markers = new L.MarkerClusterGroup({ options: {
```
Check out the [custom example](http://danzel.github.com/Leaflet.markercluster/example/marker-clustering-custom.html) for an example of this.
### Other Options
disableClusteringAtZoom: If set, at this zoom level and below markers will not be clustered. This defaults to disabled
### Events
If you register for click, mouseover, etc events just related to Markers in the cluster.
To recieve events for clusters listen to 'cluster' + 'eventIWant', ex: 'clusterclick', 'clustermouseover'.
+7 -1
View File
@@ -11,7 +11,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
spiderfyOnMaxZoom: true,
showCoverageOnHover: true,
zoomToBoundsOnClick: true
zoomToBoundsOnClick: true,
disableClusteringAtZoom: null
},
initialize: function (options) {
@@ -221,6 +223,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
maxZoom = this._map.getMaxZoom(),
currentZoom = this._map.getZoom();
if (this.options.disableClusteringAtZoom) {
maxZoom = this.options.disableClusteringAtZoom - 1;
}
//console.time('cluster');
this._topClusterLevel = this._clusterToMarkerCluster(this._needsClustering, maxZoom);
this._needsClustering = [];