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

flyTo callback #1794

Closed
tristen opened this issue Dec 3, 2015 · 6 comments
Closed

flyTo callback #1794

tristen opened this issue Dec 3, 2015 · 6 comments

Comments

@tristen
Copy link
Member

tristen commented Dec 3, 2015

Would be nice to have a callback function when a flyTo animation is complete.

@jfirebaugh
Copy link
Contributor

Can you listen for the moveend event?

@tristen
Copy link
Member Author

tristen commented Dec 3, 2015

Yes but it would be nice/clearer to do it within flyTo

@mourner
Copy link
Member

mourner commented Dec 3, 2015

I think it's better to rely on map.once('moveend', fn) here. To add a reliable callback to flyTo directly, we need to add some ugly hacks, otherwise e.g. it won't be fired when stopped externally before it finishes.

@tristen
Copy link
Member Author

tristen commented Feb 15, 2016

👍 this is a good solution. Closing.

@ansarikhurshid786
Copy link

https://gis.stackexchange.com/questions/173862/how-to-determine-when-mapbox-gl-js-flyto-has-arrived

@ThisIsOstad
Copy link
Contributor

I use this solution:

map.on('moveend', ({ originalEvent }) => {
  if (originalEvent) {
    map.fire('usermoveend');
  } else {
    map.fire('flyend');
  }
});

You can do the same for movestart.

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

No branches or pull requests

5 participants