From e376b562e50ca46d6e8cb837318c51661f96b2c1 Mon Sep 17 00:00:00 2001 From: Giuseppe Galilei Date: Tue, 5 Dec 2023 13:24:27 +0100 Subject: [PATCH] added popup bind and unbind to fix the bug raised in PR --- folium/features.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/folium/features.py b/folium/features.py index ce03ab6ce..041559b61 100644 --- a/folium/features.py +++ b/folium/features.py @@ -575,7 +575,7 @@ class GeoJson(Layer): mouseout: function(e) { if(typeof e.target.setStyle === "function"){ {%- if this.popup_keep_highlighted %} - if (!{{ this.get_name() }}.isPopupOpen()) + if (!e.target.isPopupOpen()) {%- endif %} {{ this.get_name() }}.resetStyle(e.target); } @@ -591,11 +591,13 @@ class GeoJson(Layer): if(typeof e.target.setStyle === "function"){ const highlightStyle = {{ this.get_name() }}_highlighter(e.target.feature) e.target.setStyle(highlightStyle); + e.target.bindPopup(e.popup) } }, popupclose: function(e) { if(typeof e.target.setStyle === "function"){ {{ this.get_name() }}.resetStyle(e.target); + e.target.unbindPopup() } }, {%- endif %}