Skip to content

Fix CarPlay navigation map vanishing point - #1845

Merged
1ec5 merged 3 commits into
masterfrom
1ec5-red-fish-vanishing-point-then-grow-bigger-1681
Nov 21, 2018
Merged

1ec5 merged 3 commits into
masterfrom
1ec5-red-fish-vanishing-point-then-grow-bigger-1681

Conversation

@1ec5

@1ec5 1ec5 commented Nov 20, 2018

Copy link
Copy Markdown
Contributor

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:

vanishing

After:

full chrome

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

@1ec5 1ec5 added bug Something isn’t working CarPlay Bugs, improvements and feature requests on Apple CarPlay labels Nov 20, 2018
@1ec5 1ec5 added this to the v0.25.0 milestone Nov 20, 2018
@1ec5 1ec5 self-assigned this Nov 20, 2018
@1ec5
1ec5 requested review from JThramer and frederoni November 20, 2018 03:37
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

Copy link
Copy Markdown
Contributor Author

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1849

Comment thread MapboxNavigation/CarPlayNavigationViewController.swift Outdated

@vincethecoder vincethecoder left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comment... LGTM 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn’t working CarPlay Bugs, improvements and feature requests on Apple CarPlay

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User puck rotation should account for horizontal content insets

3 participants