-
QuestionThank you for making NiceGui, realy nice! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 12 replies
-
I think i'll use a link in the hover text or context menu to start context functionality |
Beta Was this translation helpful? Give feedback.
-
Hi @RichDijk, It looks like Leaflet doesn't support click events for markers. But I might be wrong. |
Beta Was this translation helpful? Give feedback.
-
Hi @falkoschindler: yes, a native Leaflet Marker inherits click from Interactive Layer. The current "marker" in nicegui hardly deserves to be called that, as it's a small helper around a generic layer object. I do understand that it's too much to ask to implement the entire Leaflet API in Nicegui, though. To "get to" the parts of the API not exposed in Nicegui, I use a small custom "bridge" between Nicegui and JS, built from these parts:
Parts 1 & 5 of this recipe are documented, but it did take me quite some time to put the rest together. It think it would be helpful for others to include this information somewhere in the docs. (OR maybe there is already another/better way to do this...?) Anyway, see below for an example implementation of numbered clickable markers (which I happened to need myself) using this pattern. Cheers - Peter |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Edited 13/03/2024, cleaned up code, JS converted to camelCase, demo now deletes clicked marker.