Skip to content

Throttle map rendering when device unplugged #370

Closed

Description

@ericrwolfe

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.

cc @bsudekum @1ec5

Activity

  1. added this to the v0.6.0-1 milestone on Jul 19, 2017
  2. 1ec5 commented on Jul 19, 2017

    @1ec5
    Contributor

    This requires #352, because the course tracking animation built into MGLMapView can’t be disabled.

  3. ericrwolfe commented on Jul 19, 2017

    @ericrwolfe
    ContributorAuthor

    This also depends on a fix for the general battery monitoring crash: #371

  4. modified the milestones: v0.6.0-2, v0.6.0-1 on Jul 21, 2017
  5. ericrwolfe commented on Jul 27, 2017

    @ericrwolfe
    ContributorAuthor

    @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?

  6. removed this from the v0.6.0-2 milestone on Jul 27, 2017
  7. 1ec5 commented on Jul 27, 2017

    @1ec5
    Contributor

    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.

  8. ericrwolfe commented on Jul 27, 2017

    @ericrwolfe
    ContributorAuthor

    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?

  9. 1ec5 commented on Jul 28, 2017

    @1ec5
    Contributor

    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.

  10. frederoni commented on Jul 28, 2017

    @frederoni
    Contributor

    This is being implemented as part of #402 but it's blocked upstream by some camera refinements.

  11. 1ec5 commented on Jul 28, 2017

    @1ec5
    Contributor

    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.

  12. frederoni commented on Jul 28, 2017

    @frederoni
    Contributor

    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.

  13. ericrwolfe commented on Jul 31, 2017

    @ericrwolfe
    ContributorAuthor

    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?

  14. added this to the v0.9.0-1 milestone on Oct 7, 2017
  15. ericrwolfe commented on Oct 12, 2017

    @ericrwolfe
    ContributorAuthor

    Reopening as a follow on to #402.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions