mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 00:24:21 +02:00
Replace _getExpandedVisibleBounds with lat/lng diff implementation as provided by andersarstrand in #74. Should improve behaviour with custom projections
This commit is contained in:
@@ -589,13 +589,15 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
//Gets the maps visible bounds expanded in each direction by the size of the screen (so the user cannot see an area we do not cover in one pan)
|
||||
_getExpandedVisibleBounds: function () {
|
||||
var map = this._map,
|
||||
bounds = map.getPixelBounds(),
|
||||
width = L.Browser.mobile ? 0 : Math.abs(bounds.max.x - bounds.min.x),
|
||||
height = L.Browser.mobile ? 0 : Math.abs(bounds.max.y - bounds.min.y),
|
||||
sw = map.unproject(new L.Point(bounds.min.x - width, bounds.min.y - height)),
|
||||
ne = map.unproject(new L.Point(bounds.max.x + width, bounds.max.y + height));
|
||||
bounds = map.getBounds(),
|
||||
sw = bounds._southWest,
|
||||
ne = bounds._northEast,
|
||||
latDiff = L.Browser.mobile ? 0 : Math.abs(sw.lat - ne.lat),
|
||||
lngDiff = L.Browser.mobile ? 0 : Math.abs(sw.lng - ne.lng);
|
||||
|
||||
return new L.LatLngBounds(sw, ne);
|
||||
return new L.LatLngBounds(
|
||||
new L.LatLng(sw.lat - latDiff, sw.lng - lngDiff, true),
|
||||
new L.LatLng(ne.lat + latDiff, ne.lng + lngDiff, true));
|
||||
},
|
||||
|
||||
//Shared animation code
|
||||
|
||||
Reference in New Issue
Block a user