-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Add isHighAccurate property to Marker #11135
Comments
Thanks for the issue @malekeym! This is happening because markers automatically snap to the pixel grid. This creates a crisp appearance when they're stationary, but when moving markers (or when moving the map as in #8614) this jittering behavior appears.
|
Thanks for your attention @SnailBones
the first implementation involves CPU all the time when Animation running, so it's not a good idea to use this. (check the first profiling picture) the second implementation uses CSS to set Marker on the right lngLat and less more CPU and memory(check the second profiling) but if we use Marker as you can see in the example the Marker shakes, because in |
You're right, I now realize the PR I linked is for the Symbol layer "Markers" and not for HTML Markers (which as you demonstrate are much more performant option for this use case)! Thank you for your contribution! Leaving some more comments on your PR. |
@malekeym I just noticed that we do have an example of animating a HTML Marker. The jittering behavior is clear in it, especially at lower zoom levels. |
An alternative solution to introducing an option would be to always NOT round on an update, but set a debounce-like timeout that rounds the position after the marker is settled (not changing position for X ms). This might be a compromise between both use cases (keeping the icon sharp and no jitter), with the possible drawback of noticeable movement on the timeout. |
Thank you @mourner. I think with your solution we call |
@SnailBones @ryanhamley @mourner
I think the first one can fix the issue but @SnailBones said:
I think this isn't really an issue because The second suggestion can be good, but we should investigate all cases that The third suggestion is a good idea, but if we want to debounce some actions maybe we should use I want to know your idea, which one do you prefer? |
Could we use |
It will still be a minor change without performance impact, especially with @SnailBones's suggestion to use My main reason for proposing this option is to avoid expanding the API surface for something that can be an internal detail users don't have to think about. If we can make it to just work without any user-side changes for both cases, that's ideal. |
@SnailBones @mourner |
Motivation
For animating a point the example that Mapbox provided is animate point along a route. This convention has bad performance and triggers a repaint map on every update source.
as you can see The CPU is involved throughout the airplane movement.
If we use Marker instead of symbol layer the result is very different, because it works with CSS and doesn't trigger a repaint.
As you can see this convention uses less CPU and memory, but if you check this you can see Codesandbox link that movement is not smooth and sometimes the marker shakes. This behavior happens because round
marker._pos
property of Marker(maybe for performance) but if we want to implement animation movement, we should have highAccuracy.Implementation
We can add
isHighAccuracy
property and check if we want high accurate marker don't roundmarker._pos
.The text was updated successfully, but these errors were encountered: