From 5ea09108a4bf01adcd077e2a58dfe07770030005 Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Mon, 3 Jun 2024 12:19:21 -0700 Subject: [PATCH] Fix #27: navigation puck falls off route when panning The bug was especially noticeable when panning quickly or zooming in while navigating. The issue is that the upstream method signature changed in 76469a0c2227927f03a15fb95b3a20f34becc78c and then again in 8ad5f9c1fd58c60b93d26c2819637fd8f2144fd1, which first appeared in the ios-v6.0.0 tag. So our "overridden method" wasn't actually being called. It's not the commit authors fault that it broke - this is a private method we're calling. A longer term fix might be to include some kind of public stable delegate method rather than an override. --- MapboxNavigation/NavigationMapView.swift | 6 +++--- MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.h | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/MapboxNavigation/NavigationMapView.swift b/MapboxNavigation/NavigationMapView.swift index 8efbd9c3..66abeca3 100644 --- a/MapboxNavigation/NavigationMapView.swift +++ b/MapboxNavigation/NavigationMapView.swift @@ -257,9 +257,9 @@ open class NavigationMapView: MLNMapView, UIGestureRecognizerDelegate { super.anchorPoint(forGesture: gesture) } } - - override open func mapViewDidFinishRenderingFrameFullyRendered(_ fullyRendered: Bool) { - super.mapViewDidFinishRenderingFrameFullyRendered(fullyRendered) + + override open func mapViewDidFinishRenderingFrameFullyRendered(_ fullyRendered: Bool, frameEncodingTime: Double, frameRenderingTime: Double) { + super.mapViewDidFinishRenderingFrameFullyRendered(fullyRendered, frameEncodingTime: frameEncodingTime, frameRenderingTime: frameRenderingTime) guard self.shouldPositionCourseViewFrameByFrame else { return } guard let location = userLocationForCourseTracking else { return } diff --git a/MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.h b/MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.h index 8af12715..8ea47be9 100644 --- a/MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.h +++ b/MapboxNavigationObjc/MLNMapView+MLNNavigationAdditions.h @@ -2,6 +2,8 @@ @interface MLNMapView (MLNNavigationAdditions) -- (void)mapViewDidFinishRenderingFrameFullyRendered:(BOOL)fullyRendered; +- (void)mapViewDidFinishRenderingFrameFullyRendered:(BOOL)fullyRendered + frameEncodingTime:(double)frameEncodingTime + frameRenderingTime:(double)frameRenderingTime; @end