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

map.fitBounds does not animate #8970

Closed
jfrankl opened this issue Nov 12, 2019 · 2 comments
Closed

map.fitBounds does not animate #8970

jfrankl opened this issue Nov 12, 2019 · 2 comments

Comments

@jfrankl
Copy link

jfrankl commented Nov 12, 2019

mapbox-gl-js version: 1.2.0+

browser: Chrome 78.0.3904.97

Steps to Trigger Behavior

  1. Use fitBounds on any Mapbox GL JS project (example: run map.fitBounds([[-133, 16], [-68, 50]])) using version 1.2.0 or later

Link to Demonstration

Mapbox GL JS 1.1.0 (animation when you click "Test fitBounds" button): https://jsfiddle.net/hdwjby38/14/
Mapbox GL JS 1.2.0 (no animation when you click "Test fitBounds" button): https://jsfiddle.net/3svo9Lmf/7/

Expected Behavior

In earlier versions of Mapbox GL JS, running fitBounds would animate to the new location.

Actual Behavior

It appears that as of 1.2.0, the camera no longer animates. I could not find any mention of a change in the release notes, so I am assuming this is a bug. Setting an option like duration: 1000 seems to have no effect. I tested on 1.5.0 and it has the same issue.

@ryanhamley
Copy link
Contributor

The flyTo animations work as expected for me in both examples. You most likely have your computer or browser set to reduce motion which is now detected by prefers-reduced-motion starting in 1.2.0

@jfrankl
Copy link
Author

jfrankl commented Nov 13, 2019

@ryanhamley that's definitely it. Thank you.

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

2 participants