Skip to content

Commit

Permalink
Make sure the puck stays on the route while animating the map
Browse files Browse the repository at this point in the history
  • Loading branch information
boldtrn authored and michaelkirk committed Jun 14, 2024
1 parent eaee92b commit b8933fd
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions MapboxNavigation/NavigationMapView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -317,15 +317,18 @@ open class NavigationMapView: MLNMapView, UIGestureRecognizerDelegate {
}
}

// Track position on a frame by frame basis. Used for first location update and when resuming tracking mode
func enableFrameByFrameCourseViewTracking(for duration: TimeInterval) {
// MARK: - User Tracking

/**
Track position on a frame by frame basis. Used for first location update and when resuming tracking mode.
Call this method when you are doing custom zoom animations, this will make sure the puck stays on the route during these animations.
*/
@objc public func enableFrameByFrameCourseViewTracking(for duration: TimeInterval) {
NSObject.cancelPreviousPerformRequests(withTarget: self, selector: #selector(self.disableFrameByFramePositioning), object: nil)
perform(#selector(self.disableFrameByFramePositioning), with: nil, afterDelay: duration)
self.shouldPositionCourseViewFrameByFrame = true
}

// MARK: - User Tracking

@objc fileprivate func disableFrameByFramePositioning() {
self.shouldPositionCourseViewFrameByFrame = false
}
Expand Down

0 comments on commit b8933fd

Please sign in to comment.