mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 16:08:55 +02:00
A few small bug fixes and code tidy ups. Add/Remove marker (after clustering) should be all that is broken now.
This commit is contained in:
@@ -77,7 +77,7 @@ L.MarkerCluster = L.Marker.extend({
|
||||
},
|
||||
|
||||
//Removes the given node from this marker cluster (or its child as required)
|
||||
//Returns true if it (or its childCluster) removes the marker
|
||||
//Returns true if it (or a child cluster) removes the marker
|
||||
_recursivelyRemoveChildMarker: function(layer) {
|
||||
var markers = this._markers,
|
||||
childClusters = this._childClusters,
|
||||
@@ -121,12 +121,6 @@ L.MarkerCluster = L.Marker.extend({
|
||||
return false;
|
||||
},
|
||||
|
||||
_recursivelyRemoveChildrenAndAddNowVisibleMarkers: function (bounds, depthToStartAt, depthToAnimateIn) {
|
||||
this._recursively(bounds, depthToStartAt, 0, null, function (c) {
|
||||
c._recursivelyRemoveChildrenFromMap(bounds, depthToAnimateIn - 1);
|
||||
});
|
||||
},
|
||||
|
||||
_recursivelyAnimateChildrenIn: function (bounds, center, depth) {
|
||||
this._recursively(bounds, 0, depth - 1,
|
||||
function (c) {
|
||||
@@ -162,7 +156,7 @@ L.MarkerCluster = L.Marker.extend({
|
||||
c._recursivelyAnimateChildrenIn(bounds, c._group._map.latLngToLayerPoint(c.getLatLng()).round(), depthToAnimateIn);
|
||||
|
||||
//TODO: depthToAnimateIn affects _isSingleParent, if there is a multizoom we may/may not be.
|
||||
if (c._isSingleParent() /*&& depthToAnimateIn === 1*/) { //TODO: If we are the same as our parent, don't do an animation, just immediately appear
|
||||
if (c._isSingleParent() && depthToAnimateIn === 1) { //TODO: If we are the same as our parent, don't do an animation, just immediately appear
|
||||
c.setOpacity(1);
|
||||
c._recursivelyRemoveChildrenFromMap(bounds, depthToAnimateIn - 1); //Immediately remove our children as we are replacing them. TODO previousBounds not bounds
|
||||
} else {
|
||||
|
||||
@@ -372,7 +372,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
||||
markers = c._markers,
|
||||
m;
|
||||
|
||||
if (c._isSingleParent()) { //Immediately add the new child and remove us
|
||||
if (c._isSingleParent() && depthToDescend == 1) { //Immediately add the new child and remove us
|
||||
L.FeatureGroup.prototype.removeLayer.call(me, c);
|
||||
c._recursivelyAddChildrenToMap(null, depthToDescend, bounds);
|
||||
} else {
|
||||
@@ -386,7 +386,7 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
||||
for (i = markers.length - 1; i >= 0; i--) {
|
||||
m = markers[i];
|
||||
if (!bounds.contains(m._latlng)) {
|
||||
L.FeatureGroup.prototype.removeLayer.call(this, m);
|
||||
L.FeatureGroup.prototype.removeLayer.call(me, m);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -448,7 +448,9 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
||||
setTimeout(function () {
|
||||
|
||||
map._mapPane.className = map._mapPane.className.replace(' leaflet-cluster-anim', '');
|
||||
me._topClusterLevel._recursivelyRemoveChildrenAndAddNowVisibleMarkers(bounds, depthToStartAt, depthToAnimateIn);
|
||||
me._topClusterLevel._recursively(bounds, depthToStartAt, 0, null, function (c) {
|
||||
c._recursivelyRemoveChildrenFromMap(bounds, depthToAnimateIn - 1);
|
||||
});
|
||||
me._inZoomAnimation--;
|
||||
}, 250);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user