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

Add support for fitBounds and fitScreenCoordinates on globe #12211

Merged
merged 1 commit into from
Sep 6, 2022

Conversation

karimnaaji
Copy link
Contributor

@karimnaaji karimnaaji commented Sep 1, 2022

This PR adds support for fitBounds and fitScreenCoordinates with globe projection by leveraging the method introduced in #12138:

  • When calling fitBounds or fitScreenCoordinates, redirect all internal calls to _cameraForBoxAndBearing to the newly introduced method from Add support for cameraForBounds on globe projection #12138 instead of the iterative approach performing frustum intersection by raymarching steps (which isn't adapted for globe).
  • Remove the iterative method as it's now unused
  • Remove warnings about unsupported API and update the docs
  • Account for terrain directly in _cameraForBounds in order to be on par with previous behavior from the iterative frustum approach.

Fixes https://github.com/mapbox/gl-js-team/issues/502

Launch Checklist

  • briefly describe the changes in this PR
  • write tests for all new functionality
  • document any changes to public APIs
  • manually test the debug page
  • tagged @mapbox/gl-native if this PR includes shader changes or needs a native port
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>Add support for fitBounds and fitScreenCoordinates with globe projection</changelog>

src/ui/camera.js Outdated Show resolved Hide resolved
Copy link
Contributor

@SnailBones SnailBones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just a few small nits.

Base automatically changed from karim/camera-for-bounds to main September 6, 2022 20:33
Update baselines

Add unit tests

Update documentation

Address review nit
@karimnaaji karimnaaji merged commit 1b868ee into main Sep 6, 2022
@karimnaaji karimnaaji deleted the karim/fit-bounds branch September 6, 2022 20:59
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

Successfully merging this pull request may close these issues.

2 participants