python-visualization / folium

Python Data. Leaflet.js Maps.
https://python-visualization.github.io/folium/
MIT License
6.72k stars 2.21k forks source link

No popup when clicking on specific icons (BeautifyIcon plugin) #1948

Open EmanuelCastanho opened 2 weeks ago

EmanuelCastanho commented 2 weeks ago

Hi!

I was checking the BeautifyIcon plugin demo and I don't understand why when I click on the plane icon the popup doesn't show up. Here is the example: https://python-visualization.github.io/folium/latest/user_guide/plugins/beautify_icon.html

Is this a font-awesome related problem?

hansthen commented 2 weeks ago

I can confirm the issue. In the browser console I see the following stack trace:

Uncaught TypeError: Cannot read properties of undefined (reading 'x')
    at p._add (Point.js:55:19)
    at p.add (Point.js:50:23)
    at e._updatePosition (DivOverlay.js:303:45)
    at e.update (DivOverlay.js:189:8)
    at e.onAdd (DivOverlay.js:113:8)
    at e.onAdd (Popup.js:135:30)
    at e._layerAdd (Layer.js:114:8)
    at e.whenReady (Map.js:1477:13)
    at e.addLayer (Layer.js:172:8)
    at e.openOn (DivOverlay.js:63:8)
EmanuelCastanho commented 2 weeks ago

I think the problem is inside Point.js, here:

_add: function (point) {
    // destructive, used directly for performance in situations where it's safe to modify existing point
    this.x += point.x;
    this.y += point.y;
    return this;
},

At least according to the console.