mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 00:25:06 +02:00
Fix for new bug on #286
This commit is contained in:
@@ -51,7 +51,7 @@ L.MarkerCluster = L.Marker.extend({
|
||||
mapZoom = map.getZoom(),
|
||||
i;
|
||||
|
||||
//calculate how fare we need to zoom down to see all of the markers
|
||||
//calculate how far we need to zoom down to see all of the markers
|
||||
while (childClusters.length > 0 && boundsZoom > zoom) {
|
||||
zoom++;
|
||||
var newClusters = [];
|
||||
|
||||
@@ -423,16 +423,27 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
};
|
||||
|
||||
if (layer._icon && this._map.getBounds().contains(layer.getLatLng())) {
|
||||
//Layer is visible ond on screen, immediate return
|
||||
callback();
|
||||
} else if (layer.__parent._zoom < this._map.getZoom()) {
|
||||
//Layer should be visible now but isn't on screen, just pan over to it
|
||||
//Layer should be visible at this zoom level. It must not be on screen so just pan over to it
|
||||
this._map.on('moveend', showMarker, this);
|
||||
this._map.panTo(layer.getLatLng());
|
||||
} else {
|
||||
var moveStart = function () {
|
||||
this._map.off('movestart', moveStart, this);
|
||||
moveStart = null;
|
||||
};
|
||||
|
||||
this._map.on('movestart', moveStart, this);
|
||||
this._map.on('moveend', showMarker, this);
|
||||
this.on('animationend', showMarker, this);
|
||||
this._map.setView(layer.getLatLng(), layer.__parent._zoom + 1);
|
||||
layer.__parent.zoomToBounds();
|
||||
|
||||
if (moveStart) {
|
||||
//Never started moving, must already be there, probably need clustering however
|
||||
showMarker.call(this);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user