From 6852dfef88632116f24ccbedaa2eea0f77aa1d8b Mon Sep 17 00:00:00 2001 From: Frank <33519926+Conengmo@users.noreply.github.com> Date: Fri, 21 Mar 2025 10:47:26 +0100 Subject: [PATCH 1/2] make DivIcon and CustomIcon work with the new Marker approach --- folium/features.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/folium/features.py b/folium/features.py index 1c18f426d..f44840dc1 100644 --- a/folium/features.py +++ b/folium/features.py @@ -1718,7 +1718,6 @@ class DivIcon(MacroElement): """ {% macro script(this, kwargs) %} var {{ this.get_name() }} = L.divIcon({{ this.options|tojavascript }}); - {{this._parent.get_name()}}.setIcon({{this.get_name()}}); {% endmacro %} """ ) # noqa @@ -1895,7 +1894,6 @@ class CustomIcon(Icon): """ {% macro script(this, kwargs) %} var {{ this.get_name() }} = L.icon({{ this.options|tojavascript }}); - {{ this._parent.get_name() }}.setIcon({{ this.get_name() }}); {% endmacro %} """ ) # noqa From a53a7b7475e461e01b56a369bc4e68f4e2f1dfa6 Mon Sep 17 00:00:00 2001 From: Hans Then Date: Sun, 13 Apr 2025 09:00:09 +0200 Subject: [PATCH 2/2] Fixed typing --- folium/map.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/folium/map.py b/folium/map.py index e92290671..f2b8aa5ae 100644 --- a/folium/map.py +++ b/folium/map.py @@ -382,7 +382,9 @@ class SetIcon(MacroElement): """ ) - def __init__(self, marker: "Marker", icon: "Icon"): + def __init__( + self, marker: "Marker", icon: Union[Icon, "CustomIcon", "DivIcon"] + ): super().__init__() self._name = "SetIcon" self.marker = marker