diff --git a/CHANGELOG.md b/CHANGELOG.md index c2dc6be1..1db97c5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,8 @@ - Merged in * Fix: NavigationViewController displayed incorrect `speedMultiplier` when using SimulatedLocationManager - Merged in +* Adjusted the camera during navigation to show more of what's "ahead" in the route - effectively moving the puck lower on the screen. As before, see `NavigationMapViewCourseTrackingDelegate.updateCamera(_:location:,routeProgress:)` if you want to customize this behavior. + - Merged in ## v2.0.0 (May 23, 2023) * Upgrade minimum iOS version from 11.0 to 12.0. diff --git a/MapboxNavigation/NavigationMapView.swift b/MapboxNavigation/NavigationMapView.swift index 11355902..e6cbeb02 100644 --- a/MapboxNavigation/NavigationMapView.swift +++ b/MapboxNavigation/NavigationMapView.swift @@ -293,7 +293,12 @@ open class NavigationMapView: MLNMapView, UIGestureRecognizerDelegate { if !cameraUpdated { let newCamera = MLNMapCamera(lookingAtCenter: location.coordinate, acrossDistance: self.altitude, pitch: 45, heading: location.course) let function = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear) - setCamera(newCamera, withDuration: 1, animationTimingFunction: function, edgePadding: UIEdgeInsets.zero, completionHandler: nil) + + // Because it's more useful to show what's ahead than what's behind, we bias the camera to put + // the user location puck in the lower portion of the visible map, showing more of what's ahead. + let edgePadding = UIEdgeInsets(top: bounds.height * 0.4 - safeAreaInsets.bottom, left: 0, bottom: 0, right: 0) + + setCamera(newCamera, withDuration: 1, animationTimingFunction: function, edgePadding: edgePadding, completionHandler: nil) } }