@@ -490,7 +490,7 @@ func defaultFeedbackHandlers(source: FeedbackSource = .user) -> (send: FeedbackV
490
490
endOfRoute. removeFromParentViewController ( )
491
491
}
492
492
493
- func showEndOfRoute( duration: TimeInterval = 0.3 , completion: ( ( Bool ) -> Void ) ? = nil ) {
493
+ func showEndOfRoute( duration: TimeInterval = 1.0 , completion: ( ( Bool ) -> Void ) ? = nil ) {
494
494
embedEndOfRoute ( )
495
495
endOfRouteViewController. destination = destination
496
496
navigationView. endOfRouteView? . isHidden = false
@@ -512,10 +512,22 @@ func defaultFeedbackHandlers(source: FeedbackSource = .user) -> (send: FeedbackV
512
512
let noAnimation = { animate ( ) ; completion ? ( true ) }
513
513
514
514
guard duration > 0.0 else { return noAnimation ( ) }
515
+
516
+ navigationView. mapView. tracksUserCourse = false
515
517
UIView . animate ( withDuration: duration, delay: 0.0 , options: [ . curveLinear] , animations: animate, completion: completion)
516
518
517
- // Prevent the user puck from floating around.
518
- mapView. updateCourseTracking ( location: routeController. location, animated: false )
519
+ guard let height = navigationView. endOfRouteHeightConstraint? . constant else { return }
520
+ let insets = UIEdgeInsets ( top: navigationView. instructionsBannerView. bounds. height, left: 20 , bottom: height + 20 , right: 20 )
521
+
522
+ if let coordinates = routeController. routeProgress. route. coordinates, let userLocation = routeController. locationManager. location? . coordinate {
523
+ let slicedLine = Polyline ( coordinates) . sliced ( from: userLocation) . coordinates
524
+ let line = MGLPolyline ( coordinates: slicedLine, count: UInt ( slicedLine. count) )
525
+
526
+ let camera = navigationView. mapView. cameraThatFitsShape ( line, direction: navigationView. mapView. camera. heading, edgePadding: insets)
527
+ camera. pitch = 0
528
+ camera. altitude = navigationView. mapView. camera. altitude
529
+ navigationView. mapView. setCamera ( camera, animated: true )
530
+ }
519
531
}
520
532
521
533
func hideEndOfRoute( duration: TimeInterval = 0.3 , completion: ( ( Bool ) -> Void ) ? = nil ) {
0 commit comments