jupyter-widgets / ipyleaflet

A Jupyter - Leaflet.js bridge
https://ipyleaflet.readthedocs.io
MIT License
1.49k stars 363 forks source link

Removing SplitMapControl doesn't update the map layers #1233

Open dfguerrerom opened 1 month ago

dfguerrerom commented 1 month ago

Removing SplitMapControl doesn't update the map layers, if I remove this control, I would expect to leave the map as it was before of adding it? this, however doesn't happen in the MapView who triggered the event, but if I create a new view, it removes successfully the added layres.

To recreate

https://github.com/user-attachments/assets/d3d25ce7-a627-4142-befb-58170a2f652d

from ipyleaflet import Map, TileLayer, SplitMapControl
center = [34.6252978589571, -77.34580993652344]
zoom = 10
m = Map(center=center, zoom=zoom)

left = TileLayer(
    url="https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png"
)
right = TileLayer(
    url="https://cartodb-basemaps-{s}.global.ssl.fastly.net/dark_all/{z}/{x}/{y}.png"
)
control = SplitMapControl(left_layer=left, right_layer=right)
m.add(control)

And, then....

m.remove(control)
dfguerrerom commented 1 month ago

Actually this issue had to be opened in https://github.com/QuantStack/leaflet-splitmap