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 was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
[MGLMapView zoomToSouthWestCoordinate:northEastCoordinate:] not coordinates deterministic #1433
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.
changed the title [-][MGMapView zoomToSouthWestCoordinate:northEastCoordinate:] not coordinates deterministic[/-][+][MGLMapView zoomToSouthWestCoordinate:northEastCoordinate:] not coordinates deterministic[/+]on May 24, 2015
Activity
friedbunny commentedon May 6, 2015
My hack inexplicably appears to work very well, I can make it match Google's
fitBoundsperfectly (although withoutUIEdgeInsetssupport). This will be sufficient for Treble, but clearly our bounds fitting code needs cleaning up and somebody to explain/correct the math.[-][MGMapView zoomToSouthWestCoordinate:northEastCoordinate:] not coordinates deterministic[/-][+][MGLMapView zoomToSouthWestCoordinate:northEastCoordinate:] not coordinates deterministic[/+]