Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

User dot doesn’t animate between locations #6203

Closed

Description

@1ec5

#1582 has regressed. While user tracking mode is off, the user location annotation view no longer animates between locations as location updates come in.

This issue reproduces in v3.4.0-alpha.3 but not v3.4.0-alpha.2.

/cc @friedbunny @incanus

Activity

  1. added
    iOS
    annotations
    release blocker
    on Aug 29, 2016
  2. added this to the ios-v3.4.0 milestone on Aug 29, 2016
  3. self-assigned this
    on Aug 30, 2016
  4. friedbunny commented on Aug 30, 2016

    @friedbunny
    Contributor

    Tracked this down to bb2f627#diff-1994707fb909ec523ea083950eac603eR246, where we excluded position from being animatable. This change was meant to only exclude implicit animations, but it is also canceling our UIView animation in updateUserLocationAnnotationViewAnimatedWithDuration:.

  5. 1ec5 commented on Aug 30, 2016

    @1ec5
    ContributorAuthor

    bb2f627 went into v3.3.0-beta.3 as part of #5550.

  6. incanus commented on Aug 30, 2016

    @incanus
    Contributor

    Right, this is correct, but now affects the user dot since we've moved it to MGLAnnotationView. We can make an exclusion for the user dot class and subclasses?

  7. friedbunny commented on Aug 30, 2016

    @friedbunny
    Contributor

    The simplest fix is to allow position animations in MGLAnnotationView, if the class is a kind of MGLUserLocationAnnotationView:

    diff --git a/platform/ios/src/MGLAnnotationView.mm b/platform/ios/src/MGLAnnotationView.mm
    index c37adc5..352e1d3 100644
    --- a/platform/ios/src/MGLAnnotationView.mm
    +++ b/platform/ios/src/MGLAnnotationView.mm
    @@ -249,7 +249,8 @@ - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecogni
     - (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event
     {
         // Allow mbgl to drive animation of this view’s bounds.
    -    if ([event isEqualToString:@"bounds"] || [event isEqualToString:@"position"])
    +    if ([event isEqualToString:@"bounds"] ||
    +        ([event isEqualToString:@"position"] && ! [self isKindOfClass:MGLUserLocationAnnotationView.class]))
         {
             return [NSNull null];
         }

    ... but special-casing the user location annotation doesn’t strike me as a good fix. Moving other custom annotation views around the map has proven difficult and I think that’s a problem we need to solve.

  8. friedbunny commented on Aug 30, 2016

    @friedbunny
    Contributor

    That you can’t use UIView block-based animations on your annotation views doesn’t seem correct to me, either. Is that how we want it to work?

  9. 1ec5 commented on Aug 30, 2016

    @1ec5
    ContributorAuthor

    No, that's definitely a bug. I think the override in question is unnecessary as long as we bracket -updateAnnotationViews with a transaction that disables animations.

  10. friedbunny commented on Aug 30, 2016

    @friedbunny
    Contributor

    I think the override in question is unnecessary as long as we bracket -updateAnnotationViews with a transaction that disables animations.

    It looks like we already do that: MGLMapView.mm#L4548

  11. incanus commented on Aug 30, 2016

    @incanus
    Contributor

    Ah, yes! We should be ok here without doing anything for the layer actions directly.

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

Metadata

Metadata

Assignees

Labels

annotationsbugiOSrelease blocker

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions