1010class LeafletMap (ui .leaflet ):
1111 """Enhanced Leaflet map with additional functionality"""
1212
13- def __init__ (self , center : Tuple [float , float ]= (51.505 , - 0.09 ), zoom : int = 9 ,
14- with_draw_control : bool = True , classes : str = "h-96" ):
13+ def __init__ (self ,
14+ center : Tuple [float , float ]= (51.505 , - 0.09 ),
15+ zoom : int = 9 ,
16+ with_draw_control : bool = True ,
17+ classes : str = "w-full h-96" ,
18+ debug :bool = False ):
1519 """Initialize enhanced map
1620
1721 Args:
@@ -36,6 +40,7 @@ def __init__(self, center: Tuple[float, float]=(51.505, -0.09), zoom: int=9,
3640 } if with_draw_control else None
3741
3842 super ().__init__ (center = center , zoom = zoom , draw_control = draw_control )
43+ self .debug = debug
3944 self .classes (classes )
4045 self .on ('map-click' , self ._handle_click )
4146 self .on ('draw:created' , self ._handle_draw )
@@ -53,7 +58,8 @@ def _handle_draw(self, e: events.GenericEventArguments):
5358 coords = e .args ['layer' ].get ('_latlng' ) or e .args ['layer' ].get ('_latlngs' )
5459 layer_id = e .args ['layer' ].get ('_leaflet_id' )
5560 msg = f'Drawn a { layer_type } with id { layer_id } at { coords } '
56- logging .warn (msg )
61+ if self .debug :
62+ logging .warn (msg )
5763 ui .notify (msg )
5864
5965 def draw_path (self , path : List [Tuple [float , float ]], options : Dict = None ) -> Any :
0 commit comments