Skip to content

UserCourseView should update instantaneously when user gestures cause camera changes #1731

Closed

Description

@1ec5

When the user manually rotates the map using gestures, the puck should rotate synchronously with the map. Currently, there’s a bit of a lag that, while smooth, makes the puck look like it’s on a turntable. Similarly and more noticeably, when the user manually pans the map using gestures, the puck should move synchronously with the map instead of casually mosying over to the new location.

Both these issues would be fixed by disabling UserCourseView’s animation (or setting the animation duration to 0 seconds) when the map view’s camera changes for reasons other than course tracking. #1506 fixed the same issue, but only when transitioning between overview and turn-by-turn modes.

/cc @vincethecoder

Activity

  1. added
    bug
    on Sep 19, 2018
  2. 1ec5 commented on Sep 20, 2018

    @1ec5
    ContributorAuthor

    In CarPlay, it’s easy to reproduce this issue by showing and hiding the navigation bar:

    delay

  3. added this to the v0.26.0 milestone on Nov 8, 2018
  4. modified the milestones: v0.26.0, v0.25.0 on Nov 15, 2018
  5. akitchen commented on Mar 13, 2019

    @akitchen
    Contributor

    We've run into this pretty consistently recently. Per @1ec5 we should remove use of UIView animations in cases where the puck's location on screen changes in response to a map camera change.

    Related: #1949 (comment) (likely the same fix)

  6. 1ec5 commented on Mar 14, 2019

    @1ec5
    ContributorAuthor

    We are synchronizing the puck on every rendered frame, even when not in course tracking mode:

    guard let location = userLocationForCourseTracking else { return }
    userCourseView?.center = convert(location.coordinate, toPointTo: self)

    All the while, location updates are coming in, so the map view has a legitimate reason to kick off animations:

    UIView.animate(withDuration: duration, delay: 0, options: [.curveLinear, .beginFromCurrentState], animations: {
    self.userCourseView?.center = self.convert(location.coordinate, toPointTo: self)
    })

    The problem is with beginFromCurrentState: we kick off an animation, then atomically set the center a number of times during the animation (due to user gestures). The animation builds upon those explicit camera changes, resulting in a wonky additive effect. We probably need to cancel any animations when synchronizing the puck to the map due to a frame getting rendered.

    In general, the map SDK has already solved the issues around synchronizing views to the map. So we can look to the MGLMapView implementation for clues about how to solve this issue.

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

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions