mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
Fix clearLayers with spiderfied markers. Refs #162
This commit is contained in:
@@ -83,6 +83,31 @@ L.MarkerCluster.include({
|
||||
legLength += this._2PI * lengthFactor / angle;
|
||||
}
|
||||
return res;
|
||||
},
|
||||
|
||||
_noanimationUnspiderfy: function () {
|
||||
var group = this._group,
|
||||
map = group._map,
|
||||
childMarkers = this.getAllChildMarkers(),
|
||||
m, i;
|
||||
|
||||
this.setOpacity(1);
|
||||
for (i = childMarkers.length - 1; i >= 0; i--) {
|
||||
m = childMarkers[i];
|
||||
|
||||
L.FeatureGroup.prototype.removeLayer.call(group, m);
|
||||
|
||||
if (m._preSpiderfyLatlng) {
|
||||
m.setLatLng(m._preSpiderfyLatlng);
|
||||
delete m._preSpiderfyLatlng;
|
||||
}
|
||||
m.setZIndexOffset(0);
|
||||
|
||||
if (m._spiderLeg) {
|
||||
map.removeLayer(m._spiderLeg);
|
||||
delete m._spiderLeg;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -113,24 +138,7 @@ L.MarkerCluster.include(!L.DomUtil.TRANSITION ? {
|
||||
},
|
||||
|
||||
_animationUnspiderfy: function () {
|
||||
var group = this._group,
|
||||
map = group._map,
|
||||
childMarkers = this.getAllChildMarkers(),
|
||||
m, i;
|
||||
|
||||
this.setOpacity(1);
|
||||
for (i = childMarkers.length - 1; i >= 0; i--) {
|
||||
m = childMarkers[i];
|
||||
|
||||
L.FeatureGroup.prototype.removeLayer.call(group, m);
|
||||
|
||||
m.setLatLng(m._preSpiderfyLatlng);
|
||||
delete m._preSpiderfyLatlng;
|
||||
m.setZIndexOffset(0);
|
||||
|
||||
map.removeLayer(m._spiderLeg);
|
||||
delete m._spiderLeg;
|
||||
}
|
||||
this._noanimationUnspiderfy();
|
||||
}
|
||||
} : {
|
||||
//Animated versions here
|
||||
@@ -378,6 +386,12 @@ L.MarkerClusterGroup.include({
|
||||
}
|
||||
},
|
||||
|
||||
_noanimationUnspiderfy: function () {
|
||||
if (this._spiderfied) {
|
||||
this._spiderfied._noanimationUnspiderfy();
|
||||
}
|
||||
},
|
||||
|
||||
//If the given layer is currently being spiderfied then we unspiderfy it so it isn't on the map anymore etc
|
||||
_unspiderfyLayer: function (layer) {
|
||||
if (layer._spiderLeg) {
|
||||
|
||||
@@ -214,8 +214,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
delete this._gridUnclustered;
|
||||
}
|
||||
|
||||
if (this._unspiderfy) {
|
||||
this._unspiderfy();
|
||||
if (this._noanimationUnspiderfy) {
|
||||
this._noanimationUnspiderfy();
|
||||
}
|
||||
|
||||
//Remove all the visible layers
|
||||
|
||||
Reference in New Issue
Block a user