-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
getBounds value is wrong when I set fitBounds with padding #10169
Comments
Yeah, I think that's a reasonable suggestion. This would involve updating these two methods to take |
Hi Peter, I think I'm facing a similar issue. Could you update your Jsbin link, please? I see it pointing to the root jsbin.com. Thanks |
In my view, in this case bbox should not equal bbox2 as you'd like. My reasoning is that while you've asked the map to fit to bbox with a padding, the maps bounds you get after are going to be the full (outset) map bounds. In #10386 I've proposed that when a global padding is set (map.setPadding) then fitBounds/getBounds will equal, instead of passing a padding to fitBounds you could apply it to the map globally instead. |
This should be fixed by #10386. |
mapbox-gl-js version: ^1.12.0
browser: Chrome (newest)
Steps to Trigger Behavior
This causes a lot of troubles since we can't tell what is the real bbox.
We have a lot of icons and search tool on the map, so the padding is necessary, BUT still the bbox's value should be the same that I set. When I touch and move the map I'm getting a bad bbox value so when I reload the map it appears with bbox + padding values x 2, another reload makes it 3x etc etc ...
Link to Demonstration
https://jsbin.com/
Expected Behavior
fitbounds with padding should maintain the bbox's original value and shouldn't change it
Actual Behavior
Above
The text was updated successfully, but these errors were encountered: