mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 16:08:55 +02:00
Support being added and removed to the map
This commit is contained in:
@@ -302,6 +302,10 @@ L.MarkerClusterGroup.include({
|
||||
}
|
||||
},
|
||||
|
||||
_spiderfierOnRemove: function () {
|
||||
this._map.off('click zoomstart', this._unspiderfy, this);
|
||||
},
|
||||
|
||||
_unspiderfy: function () {
|
||||
if (this._spiderfied) {
|
||||
this._spiderfied.unspiderfy();
|
||||
|
||||
@@ -67,7 +67,9 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
onAdd: function (map) {
|
||||
L.FeatureGroup.prototype.onAdd.call(this, map);
|
||||
|
||||
this._generateInitialClusters();
|
||||
if (!this._topClusterLevel) {
|
||||
this._generateInitialClusters();
|
||||
}
|
||||
this._map.on('zoomend', this._zoomEnd, this);
|
||||
this._map.on('moveend', this._moveEnd, this);
|
||||
|
||||
@@ -78,6 +80,18 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
this._bindEvents();
|
||||
},
|
||||
|
||||
//Overrides FeatureGroup.onRemove
|
||||
onRemove: function (map) {
|
||||
this._map.off('zoomend', this._zoomEnd, this);
|
||||
this._map.off('moveend', this._moveEnd, this);
|
||||
|
||||
if (this._spiderfierOnRemove) { //TODO FIXME: Not sure how to have spiderfier add something on here nicely
|
||||
this._spiderfierOnRemove();
|
||||
}
|
||||
|
||||
L.FeatureGroup.prototype.onRemove.call(this, map);
|
||||
},
|
||||
|
||||
//Overrides FeatureGroup._propagateEvent
|
||||
_propagateEvent: function (e) {
|
||||
if (e.target instanceof L.MarkerCluster) {
|
||||
|
||||
Reference in New Issue
Block a user