-
Notifications
You must be signed in to change notification settings - Fork 316
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
Reinvent the course tracking wheel #402
Conversation
// didUpdateLocationIncrementallyAnimated | ||
// TODO: Call setVisibleCoordinateBounds instead to account for the location view’s bottom-weighted position on-screen. | ||
let camera = MGLMapCamera(lookingAtCenter: location.coordinate, fromDistance: 300, pitch: 45, heading: location.course) | ||
setCamera(camera, animated: true) |
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.
For #370, we need to turn animation off, at least when the device is on battery power. If we leave animation on, we’d also need to enable a linear timing curve and stretch out the animation for one second to eliminate the jumping that currently occurs.
51475bb
to
3b76603
Compare
Note that this PR currently only builds with a custom build (mapbox/mapbox-gl-native#9651) of the iOS Maps SDK that exposes |
6dd05f3
to
e9514bf
Compare
Wow, this rebase is rough times. |
The rebase was so rough I just started fresh. @frederoni @1ec5 let me know if you want me to force push this branch over this one: https://github.com/mapbox/mapbox-navigation-ios/compare/bs-bespoke-course-352. Also, do we want to move some of this logic to core? I sort of remember this being part of the conversion around this PR but I'm seeing a lot |
That branch missed some changes and undid part of #408. The rebase doesn’t seem so daunting in any case, although I’m getting some compiler errors in unrelated code.
No, we shouldn’t have Core Navigation depend on the map SDK nor on UIKit if we can help it. |
c7e7b37
to
dab8f7c
Compare
OK, I’ve rebased the PR. Currently there are two MGLMapView categories containing forward declarations, one in MapboxNavigation and the other in the Swift example application. Hopefully we can eliminate the former by taking advantage of mapbox/mapbox-gl-native#9651 and MGLMapViewDelegate. |
@1ec5 what're the next steps to finishing this PR out? |
dab8f7c
to
29973ab
Compare
I’ve been keeping the original post updated with the remaining work. Currently we have the following to-do items:
|
@1ec5 How do you feel about migrating the user puck to runtime styling? Porting the relevant parts from mapbox/mapbox-plugins-android#22? It would solve the issue we are seeing when starting navigation and going from landscape to portrait where the user puck floats around because the camera and UIView animations are not in sync. I think it could also simplify course tracking. Though, styling it would be slightly more limited. |
I don’t think this behavior is inherent to using a UIView. In fact, 049814b nearly eliminates the initial jump by making the various cameras more consistent with each other. The remaining minor jump seems to correspond to a view’s height – I wonder if we’re initially forgetting to account for a view in the edge padding.
There are pros and cons to using runtime styling for the user puck:
|
Per chat yesterday, @frederoni is going to see what can be done to modify the zoom level without leaving followWithCourse. |
@frederoni would it be possible to disable animation so the puck is more stuck to the route to fix ^? |
Fixed user puck while swiping #402 (comment) |
The merge was redone without squashing as b141077. |
…ciation Fix round-tripping pronunciations
This PR reimplements MGLMapView’s course tracking mode in MapboxNavigation. Various hacks that we previously employed to force-snap MGLMapView’s user puck have been removed. The puck continues to look like a puck during turn-by-turn navigation after panning away.
The developer can customize the user puck by setting the
NavigationMapView.userCourseView
property, which is easier to work with than a delegate method. The default user puck now looks more similar to what the Android navigation SDK displays: a larger disc that lies flatter against the map (with a halo instead of a shadow).The developer can also customize the user puck’s location on screen by implementing the
NavigationViewControllerDelegate.navigationViewController(_:mapViewUserAnchorPoint:)
method.More to come:
MGLUserTrackingModeFollowWithCourse
(to fix Bespoke course tracking #352)/cc @frederoni @bsudekum