Fix CarPlay navigation map vanishing point - #1845
Merged
1ec5 merged 3 commits intoNov 21, 2018
Merged
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.
1ec5
commented
Nov 21, 2018
| // 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 |
Contributor
Author
There was a problem hiding this comment.
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.
vincethecoder
approved these changes
Nov 21, 2018
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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