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

support fitBounds options when setting the initial map bounds #7553

Closed
andrewharvey opened this issue Nov 4, 2018 · 2 comments · Fixed by #7681
Closed

support fitBounds options when setting the initial map bounds #7553

andrewharvey opened this issue Nov 4, 2018 · 2 comments · Fixed by #7681

Comments

@andrewharvey
Copy link
Collaborator

Support for initial bounds as map constructor option was added in #5518, internally it uses fitBounds but it doesn't expose the fitBounds options padding, offset, maxZoom.

We could add a bounds_options option, but that just feels too complicated so I'm against it.

I think the best solution here will come out of #2801, which will likely open up a simpler approach to passing the initial camera state for the Map as a single object.

@andrewharvey
Copy link
Collaborator Author

One possible workaround is to set the bounds without additional fitBounds options as a Map option to get it close enough at initialisation, and then immediately call map.fitBounds with the same bounds but with additional options.

This does seem to happen fast enough that no tile requests are actually made for the original bounds with no options, only tile requests for the fitBounds with options. Given this, I'd say this issue is low priority since it would really only help to reduce roadblocks for developers who face similar issues.

@pathmapper
Copy link
Contributor

Such a bounds padding option was requested in this stackoverflow comment.

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