mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 08:02:51 +02:00
If fitBounds wouldn't zoom us down, zoom us down instead. Fixes #144
This commit is contained in:
@@ -48,8 +48,10 @@ L.MarkerCluster = L.Marker.extend({
|
||||
map = this._group._map,
|
||||
boundsZoom = map.getBoundsZoom(this._bounds),
|
||||
zoom = this._zoom + 1,
|
||||
mapZoom = map.getZoom(),
|
||||
i;
|
||||
|
||||
//calculate how fare we need to zoom down to see all of the markers
|
||||
while (childClusters.length > 0 && boundsZoom > zoom) {
|
||||
zoom++;
|
||||
var newClusters = [];
|
||||
@@ -61,6 +63,8 @@ L.MarkerCluster = L.Marker.extend({
|
||||
|
||||
if (boundsZoom > zoom) {
|
||||
this._group._map.setView(this._latlng, zoom);
|
||||
} else if (boundsZoom <= mapZoom) { //If fitBounds wouldn't zoom us down, zoom us down instead
|
||||
this._group._map.setView(this._latlng, mapZoom + 1);
|
||||
} else {
|
||||
this._group._map.fitBounds(this._bounds);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user