You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now, rendering 60fps animations between location updates is taxing on the device + battery. When the device is unplugged, we should not animate between location updates.
Yeah, overriding -[MGLMapView didUpdateLocationIncrementallyAnimated:] is along the lines of what I was thinking. Could we override with a category or in the NavigationMapView subclass without needing to swizzle and break instances outside of the navigation UI?
I agree that swizzling would be a bad idea for the reason that it would break non-NavigationMapView instances of MGLMapView. A category method override would be nondeterministic, right? Overriding in NavigationMapView would be safer, although -_setCenterCoordinate:edgePadding:zoomLevel:direction:duration:animationTimingFunction:completionHandler:, -edgePaddingForFollowing, and -directionByFollowingWithCourse are also internal, so they would need to be forward-declared as well.
By the way, if we need a tightly-scoped fix for a patch release, we can override -_setCenterCoordinate:edgePadding:zoomLevel:direction:duration:animationTimingFunction:completionHandler: in a separate PR while #402 bakes.
Unfortunately, _setCenterCoordinate:edgePadding:zoomLevel:direction:duration:animationTimingFunction:completionHandler: doesn't take pitch into account so when the device is plugged in and we're using animations, setCenter or pitch will cancel the previous transition.
I think we should continue to consider throttling when the device is unplugged, though from tests anything that involves a significant change in course (e.g. turns) looks pretty bad without animations.
Could we disable animations if the device is unplugged and the change in course/heading is small (i.e. <10-15°), otherwise animate between location updates?
Activity
1ec5 commentedon Jul 19, 2017
This requires #352, because the course tracking animation built into MGLMapView can’t be disabled.
ericrwolfe commentedon Jul 19, 2017
This also depends on a fix for the general battery monitoring crash: #371
ericrwolfe commentedon Jul 27, 2017
@1ec5 Is this something we could achieve in a first pass without a complete overhaul of course tracking, for example with a category on MGLMapView?
1ec5 commentedon Jul 27, 2017
Unfortunately not without changes to the map SDK proper or a risky hack. The CADisplayLink frame rate is determined by a constant. We could swizzle
-[MGLMapView didUpdateLocationIncrementallyAnimated:], but I’m not a fan of that approach.ericrwolfe commentedon Jul 27, 2017
Yeah, overriding
-[MGLMapView didUpdateLocationIncrementallyAnimated:]is along the lines of what I was thinking. Could we override with a category or in theNavigationMapViewsubclass without needing to swizzle and break instances outside of the navigation UI?1ec5 commentedon Jul 28, 2017
I agree that swizzling would be a bad idea for the reason that it would break non-NavigationMapView instances of MGLMapView. A category method override would be nondeterministic, right? Overriding in NavigationMapView would be safer, although
-_setCenterCoordinate:edgePadding:zoomLevel:direction:duration:animationTimingFunction:completionHandler:,-edgePaddingForFollowing, and-directionByFollowingWithCourseare also internal, so they would need to be forward-declared as well.frederoni commentedon Jul 28, 2017
This is being implemented as part of #402 but it's blocked upstream by some camera refinements.
1ec5 commentedon Jul 28, 2017
By the way, if we need a tightly-scoped fix for a patch release, we can override
-_setCenterCoordinate:edgePadding:zoomLevel:direction:duration:animationTimingFunction:completionHandler:in a separate PR while #402 bakes.frederoni commentedon Jul 28, 2017
Unfortunately,
_setCenterCoordinate:edgePadding:zoomLevel:direction:duration:animationTimingFunction:completionHandler:doesn't take pitch into account so when the device is plugged in and we're using animations, setCenter or pitch will cancel the previous transition.ericrwolfe commentedon Jul 31, 2017
I think we should continue to consider throttling when the device is unplugged, though from tests anything that involves a significant change in course (e.g. turns) looks pretty bad without animations.
Could we disable animations if the device is unplugged and the change in course/heading is small (i.e. <10-15°), otherwise animate between location updates?
ericrwolfe commentedon Oct 12, 2017
Reopening as a follow on to #402.