diff options
-rw-r--r-- | platform/darwin/src/MGLGeometry_Private.h | 3 | ||||
-rw-r--r-- | platform/ios/src/MGLMapView.mm | 9 |
2 files changed, 10 insertions, 2 deletions
diff --git a/platform/darwin/src/MGLGeometry_Private.h b/platform/darwin/src/MGLGeometry_Private.h index b91d4e0f81..652fe594f4 100644 --- a/platform/darwin/src/MGLGeometry_Private.h +++ b/platform/darwin/src/MGLGeometry_Private.h @@ -100,6 +100,9 @@ NS_INLINE BOOL MGLLocationCoordinate2DIsValid(CLLocationCoordinate2D coordinate) NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(UIEdgeInsets insets) { return { insets.top, insets.left, insets.bottom, insets.right }; } +NS_INLINE UIEdgeInsets NSEdgeInsetsFromMGLEdgeInsets(mbgl::EdgeInsets insets) { + return UIEdgeInsetsMake(insets.top(), insets.left(), insets.bottom(), insets.right()); +} #else NS_INLINE mbgl::EdgeInsets MGLEdgeInsetsFromNSEdgeInsets(NSEdgeInsets insets) { return { insets.top, insets.left, insets.bottom, insets.right }; diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 59bb1c6666..14903fcb6f 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -3649,8 +3649,13 @@ public: [self cancelTransitions]; self.cameraChangeReasonBitmask |= MGLCameraChangeReasonProgrammatic; - - mbgl::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera edgePadding:edgePadding]; + + mbgl::EdgeInsets padding = MGLEdgeInsetsFromNSEdgeInsets(edgePadding); + padding += MGLEdgeInsetsFromNSEdgeInsets(self.contentInset); + + mbgl::CameraOptions cameraOptions = [self cameraOptionsObjectForAnimatingToCamera:camera + edgePadding:NSEdgeInsetsFromMGLEdgeInsets(padding)]; + self.mbglMap.easeTo(cameraOptions, animationOptions); [self didChangeValueForKey:@"camera"]; } |