-
-
Notifications
You must be signed in to change notification settings - Fork 825
Fix initial position of pointer-tracked popup #5811
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Fix initial position of pointer-tracked popup #5811
Conversation
c44deab
to
38ae220
Compare
I would like to avoid updating handler manger for this, if possible. Also, can you share a video of the issue? |
Since there is no intended way to determine the current mouse position without using the mouse events. There is no solution that only encapsulates the popup class. The current mouse position must be cached in the map so that it is available when the popup is added to the map. An instance of a popup could be created during a mouse event. At this point, it would be too late to wait for the next mouse event. Would you prefer tracking the mouse position in the map instance via an event listener? Bug.mp4 |
but you are controlling when to add it to the map, why not set the initial location before adding it to the map? |
This comment was marked as resolved.
This comment was marked as resolved.
I found a workaround to provide an initial location. Calling popup
.setLngLat(e.lngLat)
.addTo(map)
.trackPointer(); There should probably an example about the usage especially since the documentation shows calling |
To my understanding, track pointer should be used on the entire map and less as a hover effect on a marker. |
Fixes the initial position of a pointer-tracked popup.
Currently the pointer has no position when added to the map, which results in it being displayed in the top left corner until the mouse is moved.
As initial position is now used the latest mouse position.
Launch Checklist
CHANGELOG.md
under the## main
section.