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

ZoomableGroup with CSS transition transitions on initialization #228

Open
raksooo opened this issue Sep 4, 2020 · 0 comments · May be fixed by #229
Open

ZoomableGroup with CSS transition transitions on initialization #228

raksooo opened this issue Sep 4, 2020 · 0 comments · May be fixed by #229

Comments

@raksooo
Copy link

raksooo commented Sep 4, 2020

I'm currently using a ZoomableGroup with a CSS transition on transform to animate zooming and panning. It works great except for the fact that the map transitions on initialization from the zoom value 1 to my zoom value. As far as I can tell from useZoomPan, position.k is 1 during the first render and is then set to the actual zoom value in a useEffect resulting in a second render with the correct value which then causes the map to transition between the two zoom levels.

Would it be possible to use the zoom argument the first render as well? Would it be enough to just modify it like this?

const [position, setPosition] = useState({ x: lon, y: lat, k: zoom })
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

Successfully merging a pull request may close this issue.

1 participant