-
Notifications
You must be signed in to change notification settings - Fork 318
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
Move arrow when maneuver is swiped #532
Conversation
@@ -541,6 +541,10 @@ extension RouteMapViewController: RoutePageViewControllerDelegate { | |||
mapView.setUserTrackingMode(.followWithCourse, animated: true) | |||
} | |||
} | |||
|
|||
if let stepIndex = routeController.routeProgress.currentLeg.steps.index(where: { $0 == step }) { | |||
mapView.addArrow(route: routeController.routeProgress.route, legIndex: routeController.routeProgress.legIndex, stepIndex: stepIndex) |
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'll have to figure out how to handle multiple legs here. I'm not sure even what happens when you try to swipe past the current leg.
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.
Could we get away with disallowing swiping to later legs for now?
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.
Yep, that's how this will work right now. You will only be able to swipe on the current leg.
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 is fine
MapboxNavigation/MGLMapView.swift
Outdated
let maneuverCoordinate = routeProgress.currentLegProgress.upComingStep?.maneuverLocation | ||
let polylineCoordinates = routeProgress.route.coordinates | ||
func addArrow(route: Route, legIndex: Int, stepIndex: Int) { | ||
let step = route.legs[legIndex].steps[stepIndex] |
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.
If the user manages to swipe past the last step in the leg or the last step in the route, this line will crash.
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.
Which you cannot do, but valid point, will guard.
Merging after I merge #270 |
Closes: #523
/cc @1ec5 @frederoni