You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating to the latest version, I noticed that removing a L.MarkerClusterGroup from a map no longer removes any markers or clusters. Good news is it's an easy fix.
In L.MarkerClusterGroup's onRemove function, you have this code:
this._map = null;
//Clean up all the layers we added to the map
for (var i in this._layers) {
if (this._layers.hasOwnProperty(i)) {
L.FeatureGroup.prototype.removeLayer.call(this, this._layers[i]);
}
}
Trouble is, _this.map is set to null before L.FeatureGroup's removeLayer is called, which relies on _this.map (technically L.LayerGroup's removeLayer does) with this code:
if (this._map) {
this._map.removeLayer(layer);
}
Since _this.map is already set to null by the time the above code executes, nothing happens.
SOLUTION
Set this.map to null _afterremoveLayer is called:
//Clean up all the layers we added to the map
for (var i in this._layers) {
if (this._layers.hasOwnProperty(i)) {
L.FeatureGroup.prototype.removeLayer.call(this, this._layers[i]);
}
}
this._map = null;
The text was updated successfully, but these errors were encountered:
PROBLEM
After updating to the latest version, I noticed that removing a L.MarkerClusterGroup from a map no longer removes any markers or clusters. Good news is it's an easy fix.
In L.MarkerClusterGroup's
onRemove
function, you have this code:Trouble is, _this.map is set to null before L.FeatureGroup's
removeLayer
is called, which relies on _this.map (technically L.LayerGroup'sremoveLayer
does) with this code:Since _this.map is already set to null by the time the above code executes, nothing happens.
SOLUTION
Set this.map to null _after
removeLayer
is called:The text was updated successfully, but these errors were encountered: