-
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
Allow passing bearing as an option ot fitBounds #7618
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looks good apart from the following:
- This will fail when no options are passed to
cameraForBounds
— that's why the build fails. - You could write this in a much shorter way with:
const bearing = options && options.bearing || 0;
Mentioning @dentuzhik in the hopes he will incorporate the suggested changes :) |
4ca7dae
to
835a90a
Compare
In regards to shorter way of writing, decided to keep it unchanged in favour of adding a warning about bearing being numeric, hope it's ok @mourner |
An interesting observation I made when testing with workarounds in our product is that outcome of the calculations in Same goes when you have a pitch; the pitch makes the bounding box a trapezium shape instead of a rectangle and the |
|
Closing this as stale. @dentuzhik feel free to re-open the PR when you've had a chance to address the issues mentioned at #7618 (review) |
Has this been resolved? |
Launch Checklist
I know there have been other attempts to get it to
fitBounds
, but I got it working fairly easiy with a following snippet of code (react based), hence decide to file a PR.I decided not to go with all the other checklist items, before getting any feedback, but surely can add docs and tests if necessary.
Previous art:
#1340
#1338
@mapbox/studio
and/or@mapbox/maps-design
if this PR includes style spec changes