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

Split new bounds calculation out of fitBounds into new method #6683

Merged
merged 5 commits into from
Jun 7, 2018

Conversation

lbud
Copy link
Contributor

@lbud lbud commented May 16, 2018

This breaks transform calculations out of fitBounds into a separate method, getFitBoundsTransform, so that new camera transform calculations can be known without actually moving the map.

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

Copy link
Member

@mourner mourner left a comment

Choose a reason for hiding this comment

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

Looks good! getFitBoundsTransform may sound a bit confusing though — maybe cameraForBounds?

@lbud lbud requested a review from mourner June 7, 2018 20:50
Copy link
Member

@mourner mourner left a comment

Choose a reason for hiding this comment

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

👍

src/ui/camera.js Outdated
* @see [Fit a map to a bounding box](https://www.mapbox.com/mapbox-gl-js/example/fitbounds/)
*/
fitBounds(bounds: LngLatBoundsLike, options?: AnimationOptions & CameraOptions, eventData?: Object) {
const calculatedBounds = this.cameraForBounds(bounds, options);
Copy link
Member

Choose a reason for hiding this comment

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

Nit: the variable doesn't represent the bounds, so maybe rename to calculatedOptions or cameraOptions?

@lbud lbud merged commit 2f3fa2b into master Jun 7, 2018
@lbud lbud deleted the getfitbounds branch June 7, 2018 21:48
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