-
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
map.fitBounds() with bearing does not fit the entire bounds #10064
Comments
Hello @blahblahblah- , I think this was fixed by #9821, but is not yet released. |
Hi @karimnaaji, I also tested with the latest |
Ok thanks for confirming! |
Also influences on map.fitScreenCoordinates() and map.cameraForBounds()
…thods: * `map.fitBounds()` * `map.fitScreenCoordinates()` * `map.cameraForBounds()` Consider 45 and 135 rotations and how all four corners need to be taken into account. Changes in tests: * Fix tests for camera => #cameraForBounds (they were incorrect) * Add new test for camera => #fitBounds with non-zero bearing * Changed input coordinates in tests camera => #fitScreenCoordinates to make the input region not square
…thods: * `map.fitBounds()` * `map.fitScreenCoordinates()` * `map.cameraForBounds()` Consider 45 and 135 rotations and how all four corners need to be taken into account. Changes in tests: * Fix tests for camera => #cameraForBounds (they were incorrect) * Add new test for camera => #fitBounds with non-zero bearing * Changed input coordinates in tests camera => #fitScreenCoordinates to make the input region not square (cherry picked from commit 3f151d8)
* Fix bounds/bearing calculation bug (#10064) in the following methods: * `map.fitBounds()` * `map.fitScreenCoordinates()` * `map.cameraForBounds()`
Hi @TannerPerrien it seems that your fix has been merged however, I can still reproduce it even in the latest version |
Checked on v.2.15.0, bug is not reproduced. @mapbox/gl-js , please consider to close the issue. |
If you change the demo to use bearing 135 instead of 29, you get an extra padding. Is there a workaround for this? |
When
map.fitBounds(...)
is called with a bearing option passed in, it seems like the bearing is not taken into the account on calculating the appropriate zoom, resulting in part of the bounded area to not be in view.mapbox-gl-js version: 1.12.0
browser: Chrome
Steps to Trigger Behavior
map.fitBounds(...)
with bearing option setLink to Demonstration
https://jsfiddle.net/_blahblahblah/k4vL6s5r/
Expected Behavior
When clicking on the 'Fit to Line at 29º Bearing' button in the demo link, all 6 stations should be in view.
Actual Behavior
Only 4 of the 6 stations are in view.
The text was updated successfully, but these errors were encountered: