Skip to content

Commit 6e6b070

Browse files
committed
Sync location attribute on open_popup
1 parent 21eb20b commit 6e6b070

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

ipyleaflet/leaflet.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,22 @@ class Popup(UILayer):
497497
auto_close = Bool(True).tag(sync=True, o=True)
498498
close_on_escape_key = Bool(True).tag(sync=True, o=True)
499499

500-
def open_popup(self, location=def_loc):
501-
self.send({'msg': 'open', 'location': location})
500+
def open_popup(self, location=None):
501+
""" Open the popup on the bound map
502+
503+
Parameters
504+
----------
505+
location: list, default to the internal location
506+
The location to open the popup at.
507+
"""
508+
509+
if location is not None:
510+
self.location = location
511+
self.send({'msg': 'open', 'location': self.location if location is None else location})
502512

503513
def close_popup(self):
514+
""" Close the popup on the bound map """
515+
504516
self.send({'msg': 'close'})
505517

506518
class RasterLayer(Layer):

0 commit comments

Comments
 (0)