mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Fix up crashes removing the MarkerClusterGroup from the map in a zoomstart/end handler. Crashes could come still happen depending on the order the handlers were called. Refs #36
This commit is contained in:
@@ -320,12 +320,17 @@ L.MarkerClusterGroup.include({
|
||||
_spiderfierOnRemove: function () {
|
||||
this._map.off('click', this._unspiderfyWrapper, this);
|
||||
this._map.off('zoomstart', this._unspiderfyZoomStart, this);
|
||||
this._map.off('zoomanim', this._unspiderfyZoomAnim, this);
|
||||
},
|
||||
|
||||
|
||||
//On zoom start we add a zoomanim handler so that we are guaranteed to be last (after markers are animated)
|
||||
//This means we can define the animation they do rather than Markers doing an animation to their actual location
|
||||
_unspiderfyZoomStart: function () {
|
||||
if (!this._map) { //May have been removed from the map by a zoomEnd handler
|
||||
return;
|
||||
}
|
||||
|
||||
this._map.on('zoomanim', this._unspiderfyZoomAnim, this);
|
||||
},
|
||||
_unspiderfyZoomAnim: function (zoomDetails) {
|
||||
|
||||
@@ -222,7 +222,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
},
|
||||
|
||||
_zoomEnd: function () {
|
||||
|
||||
if (!this._map) { //May have been removed from the map by a zoomEnd handler
|
||||
return;
|
||||
}
|
||||
this._mergeSplitClusters();
|
||||
|
||||
this._zoom = this._map._zoom;
|
||||
|
||||
Reference in New Issue
Block a user