Skip to content
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

The animation speed is changed whenever rerendering is triggered at different zoom levels #5

Open
Gowee opened this issue Mar 10, 2021 · 0 comments

Comments

@Gowee
Copy link

Gowee commented Mar 10, 2021

Hello!

I observed curve animation speeds up somehow in my project, which is fairly confusing.

After tons of tries, I find the problem is: the animation speed of a dashed line is changed whenever the Curve component is rerendered at a zoom level different from the initial one. More specifically, if rerendering is triggered after a zoom-in, the animation just speeds up. Then, just zoom out and trigger another rerendering, its speed returns to normal.

Screen recording:

https://i.imgur.com/lFQFKUB.mp4

Code:
https://github.com/Gowee/react-leaflet-curve/tree/speedmre

As a workaround, I have to fix the duration by compensating it with * Math.pow(2, this.mapRef.current.leafletElement.getZoom()) (divided by 2 ** zoomLevel).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant