diff --git a/CHANGELOG.md b/CHANGELOG.md index b0a7ea79a3e..3c9898956ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ ### Other changes * `RouteProgress`, `RouteLegProgress`, and `RouteStepProgress` now conform to the `Codable` protocol. ([#2615](https://github.com/mapbox/mapbox-navigation-ios/pull/2615)) +* Fixed an issue where `NavigationMapView` redrew at a low frame rate even when the device was plugged in. ([#2643](https://github.com/mapbox/mapbox-navigation-ios/pull/2643)) * Fixed an issue where the route line flickered when refreshing. ([#2642](https://github.com/mapbox/mapbox-navigation-ios/pull/2642)) ## v1.0.0 diff --git a/MapboxNavigation/NavigationMapView.swift b/MapboxNavigation/NavigationMapView.swift index 375750170ce..fa28417e2cf 100644 --- a/MapboxNavigation/NavigationMapView.swift +++ b/MapboxNavigation/NavigationMapView.swift @@ -304,15 +304,14 @@ open class NavigationMapView: MGLMapView, UIGestureRecognizerDelegate { let expectedTravelTime = stepProgress.step.expectedTravelTime let durationUntilNextManeuver = stepProgress.durationRemaining let durationSincePreviousManeuver = expectedTravelTime - durationUntilNextManeuver + let conservativeFramesPerSecond = UIDevice.current.isPluggedIn ? FrameIntervalOptions.pluggedInFramesPerSecond : minimumFramesPerSecond - if UIDevice.current.isPluggedIn { - preferredFramesPerSecond = FrameIntervalOptions.pluggedInFramesPerSecond - } else if let upcomingStep = routeProgress.currentLegProgress.upcomingStep, + if let upcomingStep = routeProgress.currentLegProgress.upcomingStep, upcomingStep.maneuverDirection == .straightAhead || upcomingStep.maneuverDirection == .slightLeft || upcomingStep.maneuverDirection == .slightRight { - preferredFramesPerSecond = shouldPositionCourseViewFrameByFrame ? FrameIntervalOptions.defaultFramesPerSecond : minimumFramesPerSecond + preferredFramesPerSecond = shouldPositionCourseViewFrameByFrame ? FrameIntervalOptions.defaultFramesPerSecond : conservativeFramesPerSecond } else if durationUntilNextManeuver > FrameIntervalOptions.durationUntilNextManeuver && durationSincePreviousManeuver > FrameIntervalOptions.durationSincePreviousManeuver { - preferredFramesPerSecond = shouldPositionCourseViewFrameByFrame ? FrameIntervalOptions.defaultFramesPerSecond : minimumFramesPerSecond + preferredFramesPerSecond = shouldPositionCourseViewFrameByFrame ? FrameIntervalOptions.defaultFramesPerSecond : conservativeFramesPerSecond } else { preferredFramesPerSecond = FrameIntervalOptions.pluggedInFramesPerSecond }