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
Remove viewport workaround in CarPlay #2134
Conversation
@frederoni Thanks. Looks good - simpler, though I'm not familiar with the code to properly review it. 100 pixels comes from CollisionIndex viewportPadding that we could also try to tweak. |
Yea, the userAnchorPoint doesn't exactly match the safeArea’s centerY which results in the viewpoint’s X position being out of sync every minor turn, so there is a small discrepancy that'll need to be addressed before this PR can land. Good pixelhunting 👁 |
mapbox/mapbox-gl-native#14664 is shipping today as part of map SDK v5.1.0. Since the bug fix isn’t shipping as a semver-major change, the workaround needs to be removed to avoid overcorrecting the vanishing point. |
#2143 prevents this SDK from working with v5.1.0 for the time being, but we need to remove that restriction and depend on v5.1.x in short order to avoid blocking various applications from upgrading the map SDK. |
@@ -337,10 +337,7 @@ open class NavigationMapView: MGLMapView, UIGestureRecognizerDelegate { | |||
if tracksUserCourse { | |||
let newCamera = camera ?? MGLMapCamera(lookingAtCenter: location.coordinate, altitude: altitude, pitch: 45, heading: location.course) | |||
let function: CAMediaTimingFunction? = animated ? CAMediaTimingFunction(name: .linear) : nil | |||
let point = userAnchorPoint | |||
let padding = UIEdgeInsets(top: point.y, left: point.x, bottom: bounds.height - point.y, right: bounds.width - point.x) | |||
// Omit padding when https://github.com/mapbox/mapbox-gl-native/pull/14081 has landed |
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.
This comment was a bit misleading: the actual workarounds were the paddings added in showcase(_:padding:animated:)
and fit(to:facing:padding:animated:)
, not the one here. The edge padding here is necessary in order to account for the puck’s uncentered location even within the content frame.
/ref #2145 (comment)
These assertions are failing and crashing on iOS 12 for some odd reason: mapbox-navigation-ios/MapboxCoreNavigationTests/NavigationEventsManagerTests.swift Lines 55 to 57 in db19ffe
|
Now that mapbox/mapbox-gl-native#14664 gained traction, I took the chance to remove the hacky workaround for the viewport in CarPlay and the NavigationMapView.
This PR is blocked by the PR mentioned above, and a new release of the Maps SDK. As well as some cleanup work and testing.
This PR will unblock #1139
Fixes #2134.
cc @mapbox/navigation-ios @astojilj