-
Notifications
You must be signed in to change notification settings - Fork 93
removeLayer()
not working properly from within map.on
#68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
After some more digging I found that the order things are added and removed matter when inside You're looping over elements in the panel, while going down the list, the thing that comes first gets removed and the thing you clicked gets added. Going up the list, you add before you remove. I fixed this by adding two vars, |
Hi, this is great! I am having a similar issue and I am glad theres a solution. Do you have an example of this solution? I am having dificulty visualizing it in the code. Thank you, |
You can checkout my changes over here https://github.com/designgears/leaflet-groupedlayercontrol/blob/4e10f5e28a3d7e423e90d7cd7648e4f76b0003ac/src/leaflet.groupedlayercontrol.js#L390 |
When calling
removeLayer()
from withinmap.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.Removing a layer outside of the
map.on
event works as expected, the menu doesn't get wonky.The text was updated successfully, but these errors were encountered: