mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-27 00:25:06 +02:00
Fix places we were looping over this._layers to use this._featureGroup.eachLayer instead. Fixes child markers not being added to the map.
This commit is contained in:
+14
-18
@@ -166,12 +166,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
}
|
||||
|
||||
//Update the icons of all those visible clusters that were affected
|
||||
for (i in this._layers) {
|
||||
m = this._layers[i];
|
||||
if (m instanceof L.MarkerCluster && m._iconNeedsUpdate) {
|
||||
m._updateIcon();
|
||||
fg.eachLayer(function (c) {
|
||||
if (c instanceof L.MarkerCluster && c._iconNeedsUpdate) {
|
||||
c._updateIcon();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
|
||||
|
||||
@@ -180,7 +179,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
|
||||
//Takes an array of markers and removes them in bulk
|
||||
removeLayers: function (layersArray) {
|
||||
var i, l, m;
|
||||
var i, l, m,
|
||||
fg = this._featureGroup;
|
||||
|
||||
if (!this._map) {
|
||||
for (i = 0, l = layersArray.length; i < l; i++) {
|
||||
@@ -198,8 +198,8 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
|
||||
this._removeLayer(m, true, true);
|
||||
|
||||
if (this._featureGroup.hasLayer(m)) {
|
||||
this._featureGroup.removeLayer(m);
|
||||
if (fg.hasLayer(m)) {
|
||||
fg.removeLayer(m);
|
||||
if (m.setOpacity) {
|
||||
m.setOpacity(1);
|
||||
}
|
||||
@@ -209,12 +209,11 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
|
||||
//Fix up the clusters and markers on the map
|
||||
this._topClusterLevel._recursivelyAddChildrenToMap(null, this._zoom, this._currentShownBounds);
|
||||
|
||||
for (i in this._layers) {
|
||||
m = this._layers[i];
|
||||
if (m instanceof L.MarkerCluster) {
|
||||
m._updateIcon();
|
||||
fg.eachLayer(function (c) {
|
||||
if (c instanceof L.MarkerCluster) {
|
||||
c._updateIcon();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
@@ -824,18 +823,15 @@ L.MarkerClusterGroup.include(!L.DomUtil.TRANSITION ? {
|
||||
});
|
||||
|
||||
this._forceLayout();
|
||||
var j, n;
|
||||
|
||||
//Update opacities
|
||||
me._topClusterLevel._recursivelyBecomeVisible(bounds, newZoomLevel);
|
||||
//TODO Maybe? Update markers in _recursivelyBecomeVisible
|
||||
for (j in me._layers) {
|
||||
n = me._layers[j];
|
||||
|
||||
fg.eachLayer(function (n) {
|
||||
if (!(n instanceof L.MarkerCluster) && n._icon) {
|
||||
n.setOpacity(1);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//update the positions of the just added clusters/markers
|
||||
me._topClusterLevel._recursively(bounds, previousZoomLevel, newZoomLevel, function (c) {
|
||||
|
||||
Reference in New Issue
Block a user