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

Wrong zoom level when setMaxBounds #10209

Closed
rullymartanto opened this issue Dec 15, 2020 · 3 comments
Closed

Wrong zoom level when setMaxBounds #10209

rullymartanto opened this issue Dec 15, 2020 · 3 comments

Comments

@rullymartanto
Copy link

rullymartanto commented Dec 15, 2020

"mapbox-gl": "^1.12.0",

when using setMaxBounds
image

When using fitBounds

image

There is a bug or wrong implementation ?

@rullymartanto rullymartanto changed the title Dynamic Maxbounds / map panning? Wrong zoom level when setMaxBounds Dec 15, 2020
@rullymartanto rullymartanto reopened this Dec 15, 2020
@andrewharvey
Copy link
Collaborator

also #6969

@andrewharvey
Copy link
Collaborator

In short the current implementation say ensure that no part of the map shows something outside of the maxBounds, hence to ensure that remains regardless of your bounds aspect ratio and viewport aspect ratio, you won't usually be able to fitBounds to the maxBounds and have all the maxBounds showing (unless their aspect ratio match).

For many use cases, this is not very useful because you still want to let users zoom out to see a whole country in the one view (for example), but not pan outside that country. The current implementation doesn't allow this.

@mourner
Copy link
Member

mourner commented Dec 16, 2020

Yes, thanks for summarizing this well @andrewharvey — let's keep the discussion centralized in #6969.

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

3 participants