The Wayback Machine - https://web.archive.org/web/20220616035936/https://github.com/mapbox/mapbox-gl-js/issues/11337
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

Fitbounds with center option not doing expected thing #11337

Open
malekeym opened this issue Dec 10, 2021 · 4 comments
Open

Fitbounds with center option not doing expected thing #11337

malekeym opened this issue Dec 10, 2021 · 4 comments

Comments

@malekeym
Copy link
Contributor

@malekeym malekeym commented Dec 10, 2021

mapbox-gl-js version:2.6.1

browser:Chrome

Steps to Trigger Behavior

1.create LngLatBounds as bounds
2 .use map.fitBounds and pass the center option to it

Link to Demonstration

check out this link for more info:
https://jsbin.com/zodotod/edit?html,output

Expected Behavior

The bounds should be in the view and the center of the map should be the center option

Actual Behavior

Just flyTo the center

@Al-0
Copy link

@Al-0 Al-0 commented Dec 17, 2021

I think that center is not an option for the fitBounds method.
https://docs.mapbox.com/mapbox-gl-js/api/map/#map#fitbounds

Screen Shot 2021-12-17 at 17 03 12

@malekeym
Copy link
Contributor Author

@malekeym malekeym commented Dec 18, 2021

@ai-santos I think, You are wrong
image

@Al-0
Copy link

@Al-0 Al-0 commented Dec 18, 2021

Hmmm, now that you mention it, it should be available as part of the CameraOptions, I will look into it.

@Jeremboo
Copy link

@Jeremboo Jeremboo commented Apr 25, 2022

Just to follow up because I have the same problem. I'm using v2.7.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants