New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix CarPlay navigation map vanishing point #1845
Fix CarPlay navigation map vanishing point #1845
Conversation
NavigationMapView can’t assume that its containing view controller is widening it to account for safe area insets. Balanced out the width adjustment so that the fix also applies when the status bar is on the right side of the screen.
// Adjust the map’s vanishing point to counterbalance the side maneuver panels by extending the view off beyond the other side of the screen. | ||
if let mapView = mapView { | ||
mapViewRightSafeAreaBalancingConstraint?.constant = -mapView.safeArea.right | ||
mapViewLeftSafeAreaBalancingConstraint?.constant = mapView.safeArea.left |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m still a bit concerned about this fix, because for some reason the right safe area inset seems to contradict the behavior of the map buttons on the right. For example, the safe area insets look like this when the navigation bar and map buttons are shown:
(UIEdgeInsets) $R6 = {
top = 0
left = 148
bottom = 0
right = 0
}
but like this when the navigation bar and map buttons are hidden:
(UIEdgeInsets) $R8 = {
top = 44
left = 148
bottom = 0
right = 38
}
As a result, the puck ends up slightly too far to the left when the buttons are hidden and too far to the right when the buttons are shown. Even so, at least the puck and vanishing point are aligned, so I guess addressing this issue can be tail work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
→ #1849
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment... LGTM 👍
Fixed an issue where the user puck pointed away from the route line during turn-by-turn navigation in CarPlay. The map’s vanishing point now accounts for safe area insets, including the side maneuver view. As described in #1681 (comment), we now place the map view’s horizontal center where we want the vanishing point to be. This approach is preferable to rotating the map because it preserves the angles at which cross streets meet the route line.
Before:
After:
Before this PR can land, I need to fix a regression where standalone NavigationMapViews on the iPhone fail to respect the safe area insets.
Fixes #1681.
/cc @mapbox/navigation-ios @d-prukop