File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed
Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -275,7 +275,6 @@ class Icon(MacroElement):
275275 var {{ this.get_name() }} = L.AwesomeMarkers.icon(
276276 {{ this.options|tojavascript }}
277277 );
278- {{ this._parent.get_name() }}.setIcon({{ this.get_name() }});
279278 {% endmacro %}
280279 """
281280 )
@@ -402,9 +401,7 @@ def __init__(
402401 draggable = draggable or None , autoPan = draggable or None , ** kwargs
403402 )
404403 if icon is not None :
405- # this makes sure it is added only once
406- self ._parent .add_child (icon , name = icon .get_name (), index = 0 )
407- self .icon = icon
404+ self .add_child (icon )
408405 if popup is not None :
409406 self .add_child (popup if isinstance (popup , Popup ) else Popup (str (popup )))
410407 if tooltip is not None :
@@ -421,12 +418,13 @@ def _get_self_bounds(self) -> TypeBoundsReturn:
421418 return cast (TypeBoundsReturn , [self .location , self .location ])
422419
423420 def render (self ):
424- if self .icon :
425- self .add_child (self .SetIcon (marker = self , icon = self .icon ))
426421 if self .location is None :
427422 raise ValueError (
428423 f"{ self ._name } location must be assigned when added directly to map."
429424 )
425+ for child in list (self ._children .values ()):
426+ if isinstance (child , Icon ):
427+ self .add_child (self .SetIcon (marker = self , icon = child ))
430428 super ().render ()
431429
432430
You can’t perform that action at this time.
0 commit comments