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

Fix bug preventing animated "Map#rotateTo" operations inside "moveend" event listener #2855

Closed
lcapel opened this issue Jul 12, 2016 · 2 comments · Fixed by #2944
Closed

Comments

@lcapel
Copy link

lcapel commented Jul 12, 2016

Hi, I'm using the latest version of Mapbox GL JS (0.20.1) and I have this issue where when I try to call rotateTo() after a moveend event fires nothing happens. If I try to call flyTo() instead, it works. I'm not sure if I'm doing anything silly, here are two simple examples demonstrating the issue.

http://jsbin.com/demecovehi/1/edit?html,console,output - Fly after move end

http://jsbin.com/komaloceci/1/edit?html,console,output - Rotate after move end

@lucaswoj lucaswoj changed the title rotateTo not working after 'moveend' event fires Fix bug preventing animated "Map#rotateTo" operations inside "moveend" event listener Jul 29, 2016
@lucaswoj
Copy link
Contributor

This bug can be avoided by setting duration to 0 or placing the call to rotateTo within a setTimeout(..., 0) block. I suspect we are getting tripped up by the inability to have multiple overlapping camera animations.

There is likely an easy fix to this issue by ending the camera animation before emitting the "moveend" event.

related to #2801

@lcapel
Copy link
Author

lcapel commented Aug 4, 2016

The workaround will get me going for now, thanks for the tip! Using requestAnimationFrame(() => { ... } ) will also do the same thing 👍

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

Successfully merging a pull request may close this issue.

3 participants