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.
setVisibleCoordinateBounds:edgePadding:animated: not working for iPhone 6 #1817
Okay, here's a weird one. I am using setVisibleCoordinateBoundsedgePaddinganimated: to zoom the map into a route. On iPhone 5S, this work perfectly. However, on the iPhone 6 the map is centered way off into the mountains. I've double checked that I am passing in the same coordinates. The only difference (from what I can tell) is that the map is a bit wider on the iPhone 6 screen.
Huh, I tested this functionality on an iPhone 6, actually. Some questions for you:
Does the MGLMapView’s frame match your expectations?
Do you see the same behavior with and without animation?
Are you doing anything else that would affect the viewport (like zooming or rotating), at any time from the call to -setVisibleCoordinateBounds:edgePadding:animated: to after the animation runs to completion? (If you were to call, say, -resetNorth just before this point, the asynchronous animation could interfere with the bounds fitting.)
For iPhone 5S the map frame is 0,0,204,196. For iPhone 6 the map frame is 0,0,359,295. Both do match my expectations
Same results with animated:YES and animated:NO
I am creating a new instance of map view, set userInteractionEnabled:YES, add map view as a subview to a UIView, add one polyline annotation and two point annotations, calculate my sw and ne corners and call setVisibleCoordinateBounds:edge:animated:NO You can see above that the coordinates are the same for both maps. The only difference that I can see is the frame size of the map view.
After some more research, this bug is being caused by the map's zoom level before calling this method. A zoom level of <6 causes a noticeable level of inaccuracy. The lower the zoom level (before calling this method) causes a larger discrepancy.
That's what causes the problem, but still unknown is why, and why it would only affect iPhone 6???!!
I can reproduce this just as you describe: only on iPhone 6. I wasn’t noticing it before because the offset is an absolute distance, yet I was only testing fitting to rather large bounds, such as the shape of Colorado.
changed the title [-]setVisibleCoordinateBoundsedgePaddinganimated: not working for iPhone 6[/-][+]setVisibleCoordinateBounds:edgePadding:animated: not working for iPhone 6[/+]on Jul 2, 2015
The basic issue described in #1433 still persists to some extent: in Map::fitBounds(), centerLatLng differs based on the current zoom level. When I try to fit the idealized bounds of Colorado (37°N–41°N × 109°2′48″W–102.05°W) at z0 with 32 pixels of top padding on a portrait iPhone 6, centerLatLng is (39.441750492506543°N, 105.28772469824946°W). But if I do the same at approximately z5, centerLatLng is (39.265443576279353°N, 105.51573333333334°W), which is much closer to the correct value.
Activity
1ec5 commentedon Jul 1, 2015
Huh, I tested this functionality on an iPhone 6, actually. Some questions for you:
-setVisibleCoordinateBounds:edgePadding:animated:to after the animation runs to completion? (If you were to call, say,-resetNorthjust before this point, the asynchronous animation could interfere with the bounds fitting.)picciano commentedon Jul 1, 2015
setVisibleCoordinateBounds:edge:animated:NOYou can see above that the coordinates are the same for both maps. The only difference that I can see is the frame size of the map view.picciano commentedon Jul 1, 2015
Edge padding is also the same in both cases.
picciano commentedon Jul 1, 2015
Two more notes:
picciano commentedon Jul 1, 2015
After some more research, this bug is being caused by the map's zoom level before calling this method. A zoom level of <6 causes a noticeable level of inaccuracy. The lower the zoom level (before calling this method) causes a larger discrepancy.
That's what causes the problem, but still unknown is why, and why it would only affect iPhone 6???!!
1ec5 commentedon Jul 2, 2015
I can reproduce this just as you describe: only on iPhone 6. I wasn’t noticing it before because the offset is an absolute distance, yet I was only testing fitting to rather large bounds, such as the shape of Colorado.
[-]setVisibleCoordinateBoundsedgePaddinganimated: not working for iPhone 6[/-][+]setVisibleCoordinateBounds:edgePadding:animated: not working for iPhone 6[/+]1ec5 commentedon Jul 2, 2015
The basic issue described in #1433 still persists to some extent: in
Map::fitBounds(),centerLatLngdiffers based on the current zoom level. When I try to fit the idealized bounds of Colorado (37°N–41°N × 109°2′48″W–102.05°W) at z0 with 32 pixels of top padding on a portrait iPhone 6,centerLatLngis (39.441750492506543°N, 105.28772469824946°W). But if I do the same at approximately z5,centerLatLngis (39.265443576279353°N, 105.51573333333334°W), which is much closer to the correct value.1ec5 commentedon Jul 2, 2015
picciano commentedon Jul 2, 2015
nice, makes sense...now