mirror of
https://github.com/stylersnico/librenms.git
synced 2026-08-02 00:32:09 +02:00
Add options.disableClusteringAtZoom. Only implemented for initial clustering currently
This commit is contained in:
@@ -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.
|
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
|
### Events
|
||||||
If you register for click, mouseover, etc events just related to Markers in the cluster.
|
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'.
|
To recieve events for clusters listen to 'cluster' + 'eventIWant', ex: 'clusterclick', 'clustermouseover'.
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
|
|
||||||
spiderfyOnMaxZoom: true,
|
spiderfyOnMaxZoom: true,
|
||||||
showCoverageOnHover: true,
|
showCoverageOnHover: true,
|
||||||
zoomToBoundsOnClick: true
|
zoomToBoundsOnClick: true,
|
||||||
|
|
||||||
|
disableClusteringAtZoom: null
|
||||||
},
|
},
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
@@ -221,6 +223,10 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
|||||||
maxZoom = this._map.getMaxZoom(),
|
maxZoom = this._map.getMaxZoom(),
|
||||||
currentZoom = this._map.getZoom();
|
currentZoom = this._map.getZoom();
|
||||||
|
|
||||||
|
if (this.options.disableClusteringAtZoom) {
|
||||||
|
maxZoom = this.options.disableClusteringAtZoom - 1;
|
||||||
|
}
|
||||||
|
|
||||||
//console.time('cluster');
|
//console.time('cluster');
|
||||||
this._topClusterLevel = this._clusterToMarkerCluster(this._needsClustering, maxZoom);
|
this._topClusterLevel = this._clusterToMarkerCluster(this._needsClustering, maxZoom);
|
||||||
this._needsClustering = [];
|
this._needsClustering = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user