-
Notifications
You must be signed in to change notification settings - Fork 313
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
Simplify anchor point calculation and puck centering #2211
Conversation
|
||
if overviewing { | ||
insets += NavigationMapView.courseViewMinimumInsets | ||
|
||
let routeLineWidths = MBRouteLineWidthByZoomLevel.compactMap { $0.value.constantValue as? Int } | ||
insets += UIEdgeInsets(floatLiteral: Double(routeLineWidths.max() ?? 0)) | ||
} else if mapView.tracksUserCourse { |
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.
RouteMapViewController is used by NavigationViewController but not CarPlayNavigationViewController. Developers are also responsible for implementing their own preview map or free-driving map using a standalone NavigationMapView. So this code would need to be duplicated in CarPlayNavigationViewController and application code. It would be better to keep the code in NavigationMapView if possible.
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.
After 98551dd
CarPlayNavigationViewController and NavigationViewController contentInset() functions are very close and seems feasible to extract common part to NavigationMapView.
As I don't have enough understanding of navigation-ios API surface. it is better if someone else from navigation-ios team continue on formulating the API, that is if the workarounds taken here are fine.
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.
We’re going to address duplication between CarPlayNavigationViewController and NavigationViewController overall in a separate PR ahead of v1.0.
@@ -194,8 +183,6 @@ open class NavigationMapView: MGLMapView, UIGestureRecognizerDelegate { | |||
if let userCourseView = userCourseView { | |||
if let location = userLocationForCourseTracking { | |||
updateCourseTracking(location: location, animated: false) | |||
} else { | |||
userCourseView.center = userAnchorPoint |
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.
Remove the need to specify center for puck view - use the approach where content inset is keeping it centered.
We need to check whether undoing #2047 ends up regressing #1731 and #1949. Also, does the puck consistently remain at userAnchorPoint
when simulation is sped up?
/ref @frederoni
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.
Also, does the puck consistently remain at userAnchorPoint when simulation is sped up?
Yes, it remains. It is always centered to padding area and no need to reposition it. Attached video to show:
https://www.dropbox.com/s/wori62tfhp69feg/RPReplay_Final1565767435.mp4?dl=0
Also, the issue here is fixed: mapbox/mapbox-gl-native#15233 (comment)
This is at most a workaround. A downstream change does not fix an upstream regression. |
… safeArea. Panning fix. Fix CarPlay puck positioning, panning away from navigation, navigation -> overview transitions. The workaround should be future proof as the mapbox/mapbox-gl-native#15574 exists only with MGLMapView.contentInset. Additionally, it simplifies the code as it doesn't need to ensure that safeArea and contentInset are kept in sync: according to work in #2211, contentInset is to be used to position puck and this causes map position sudden change when panning. Fixes: #2190
34822f9
to
98551dd
Compare
When this will be merged? We can no longer use mapbox navagtion 0.34 with mapbox ios sdk 5.0.0 because it fails to compile with Swift 5.1 (which is forced with Xcode 11.0). Having to update to 0.37, this is a critical bug which blocks any releases we can do to our app. 😣 Having this bug in production is not an option because it critically deteriorates the user experience which was working well before. If there is any work around, or if this issue can be prioritised, that would be greatly appreciated. |
It is currently in review and some manual verification is needed. Did you try if it fixes the issues in your application? |
WORKS FABULOUSLY! Even closing the top nav bar stopped crashing the app! For anyone who's coming across this, the commit id for this PR's branch is:
Thanks! |
This PR will go in as soon as we’re able to verify that it doesn’t break navigation on a CarPlay device. In the meantime, if you don’t use CarPlay functionality, feel free to use this branch as described above. |
Decouple dependency content insets -> anchor point -> padding/content insets broken after mapbox/mapbox-gl-native#14664 introduced animated interpolation for padding change. Remove the need to specify center for puck view - use the approach where content inset is keeping it centered. Take safeArea into account when calculating contentInsets. Addresses: mapbox/mapbox-gl-native#15232, mapbox/mapbox-gl-native#15233 Related to: #2165, Fixes: #2145
… safeArea. Panning fix. Fix CarPlay puck positioning, panning away from navigation, navigation -> overview transitions. The workaround should be future proof as the mapbox/mapbox-gl-native#15574 exists only with MGLMapView.contentInset. Additionally, it simplifies the code as it doesn't need to ensure that safeArea and contentInset are kept in sync: according to work in #2211, contentInset is to be used to position puck and this causes map position sudden change when panning. Fixes: #2190
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.
Decouple dependency content insets -> anchor point -> padding/content insets broken after mapbox/mapbox-gl-native#14664 introduced animated interpolation for padding change.
Remove the need to specify center for puck view - use the approach where content inset is keeping it centered.
Take safeArea into account when calculating contentInsets.
Link to video showing current state.
EDIT 9/9/2019:
Work around mapbox-gl-native/15574. Panning fix.
Fix CarPlay puck positioning, panning away from navigation, navigation -> overview transitions.
Remove syncing safeArea to contentInset, contentInset is to be used to position puck and this causes map position sudden change when panning.
Work around mapbox-gl-native/15574: should be future proof as the mapbox/mapbox-gl-native#15574 exists only with MGLMapView.contentInset.
Addresses: mapbox/mapbox-gl-native#15232, mapbox/mapbox-gl-native#15233
Related to: #2165,
Fixes: #2145, #2190