Replies: 1 comment 1 reply
-
Thanks for taking the time to open this discussion! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Popup code I find is a constant pain point with this library (and Mapbox GL JS). It is too low-level.
Example: Creating popups on hover for tessellating polygons is a surely common requirement, yet one of a number of things that I find is unduly over-complex. Having to mess around with low-level stuff like having to track last selected features on mouse moves is not great. (In general, the library as a whole needs some focus on creating higher-level abstractions to cover common use-cases by moving common stuff in new native options/flags.)
Below is code we use that involves show-on-hover popups on polygons, with simple styling to highlight the current polygon. It's frankly a huge amount of code for such a standard UI concept. It is difficult to get right. There are still issues like flickering popups if the mouse is moved into a popup. I discuss the problems afterwards below.
Problems here are:
mousemove
and manually tracking a cached featureId is very low-level and does not clearly express the semantic intent;generateId
has to be enabled, polluting the data with a public ID property just in order to track state;hovered
property state natively, that styles will assume is always there;I would like to see a more semantic approach that abstracts away all this stuff at library-level. Something like the following, with simple defaults facilitating the 99% of UI variations people tend to use:
I release this proposal into the public domain without attribution.
For transparency, I have also posted the same thing on the Mapbox GL JS site, as the same issues apply, but I tend to work nowadays in Maplibre most of the time.
Beta Was this translation helpful? Give feedback.
All reactions