You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
I expected the method to always fit the given coordinates on the screen — instead, it zooms in on their center point at a zoom level calculated based on _mbglMap->getScale(). This often results in z18 and never actually fits the viewport to the exact coordinate bounds.
Calling the method repeatedly with the same coordinates but at different zooms yields this:
[MGMapView zoomToSouthWestCoordinate:northEastCoordinate:animated:] is only used right now for centering the map on the user location annotation and is somewhat broken for that purpose, too, besides not being a public method. (#1092 tracks what to do about this API decision.)
I would like to use this method for bounds-based syncing in the demo app I'm working on, so I've hacked together an interim solution, but the maths are absolutely wrong:
My hack inexplicably appears to work very well, I can make it match Google's fitBounds perfectly (although without UIEdgeInsets support). This will be sufficient for Treble, but clearly our bounds fitting code needs cleaning up and somebody to explain/correct the math.
friedbunny
changed the title
[MGMapView zoomToSouthWestCoordinate:northEastCoordinate:] not coordinates deterministic
[MGLMapView zoomToSouthWestCoordinate:northEastCoordinate:] not coordinates deterministic
May 24, 2015
Using
[MGMapView zoomToSouthWestCoordinate:northEastCoordinate:animated:]
produces a different result based on the zoom/scale of the map.I expected the method to always fit the given coordinates on the screen — instead, it zooms in on their center point at a zoom level calculated based on
_mbglMap->getScale()
. This often results inz18
and never actually fits the viewport to the exact coordinate bounds.Calling the method repeatedly with the same coordinates but at different zooms yields this:
[MGMapView zoomToSouthWestCoordinate:northEastCoordinate:animated:]
is only used right now for centering the map on the user location annotation and is somewhat broken for that purpose, too, besides not being a public method. (#1092 tracks what to do about this API decision.)I would like to use this method for bounds-based syncing in the demo app I'm working on, so I've hacked together an interim solution, but the maths are absolutely wrong:
I put together a demonstration of this bug and my hack in a branch here. Use the action sheet's "Zoom to Oregon" option to see new default behavior.
/cc @incanus @1ec5
The text was updated successfully, but these errors were encountered: