ipyleaflet icon indicating copy to clipboard operation
ipyleaflet copied to clipboard

Move popup

Open lopezvoliver opened this issue 1 year ago • 1 comments

Updating the location of a Popup should move it to that location, as seen in this jsfiddle:

ipyleaflet-popup-jsfiddle

But in ipyleaflet this doesn't work:

First setup the map:

import ipyleaflet
from ipywidgets import HTML

m = ipyleaflet.Map(center=[51.505, -0.09])
info = HTML("Hello world")

popup = ipyleaflet.Popup(
    location = [51.505, -0.09],
    child = info,
    close_button = True,
    auto_close=True,
    close_on_escape_key=True
)
m.add(popup)

m

Then try to update the popup location in another cell:

popup.location=[51.505, 0]

ipyleaflet-popup-notebook

lopezvoliver avatar Oct 28 '24 06:10 lopezvoliver

Here's a workaround:

popup.location = [51.505, 0] 
popup.close_popup()
popup.open_popup()

lopezvoliver avatar Oct 28 '24 06:10 lopezvoliver