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

CameraUpdateFactory.newLatLngBounds() not returning greatest possible zoom #211

Closed
ahuang13 opened this issue Nov 1, 2016 · 2 comments
Closed

Comments

@ahuang13
Copy link
Contributor

ahuang13 commented Nov 1, 2016

/**
 * Returns a CameraUpdate that transforms the camera such that the specified latitude/longitude
 * bounds are centered on screen at the greatest possible zoom level.
 * You can specify padding, in order to inset the bounding box from the map view's edges.
 * The returned CameraUpdate has a bearing of 0 and a tilt of 0.
 *
 * @param bounds  Bounds to match Camera position with
 * @param padding Padding added to the bounds
 * @return CameraUpdate Final Camera Position
 */
public static CameraUpdate newLatLngBounds(@NonNull LatLngBounds bounds, int padding)

The "... at the greatest possible zoom level" guarantee does not always hold true. The resulting zoom (and center) will vary depending on the initial bearing of the map when the CameraUpdate is applied.

When the map starts out at 0-degree bearing, the "greatest possible zoom level" will hold true. If the map starts out at any non-zero bearing, however, we will likely get a suboptimal zoom level with newLatLngBounds().

@cammace
Copy link
Contributor

cammace commented Nov 22, 2016

This is actually a bug we are tracking in both mapbox/mapbox-gl-native#2259 and mapbox/mapbox-gl-native#4796. Closing ticket in favor of those issues.

@cammace cammace closed this as completed Nov 22, 2016
@ahuang13
Copy link
Contributor Author

👍

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

No branches or pull requests

2 participants