leaflet-panel-layers icon indicating copy to clipboard operation
leaflet-panel-layers copied to clipboard

`removeLayer()` not working properly from within `map.on`

Open designgears opened this issue 1 year ago • 1 comments

When calling removeLayer() from within map.on event the baselayer menu gets a bit wonky. After removing even a single layer I can click thru the baselayers top to bottom just fine, but going out of order clicking at random requires I click the radio button twice. This also seemed to happen with overlay layers, requiring two clicks to check the box.

map.on('baselayerchange', (e) => {
    control.removeLayer(somelayergrouphere);
}

Removing a layer outside of the map.on event works as expected, the menu doesn't get wonky.

designgears avatar May 16 '23 20:05 designgears