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.

[ios] Cannot determine in completion block whether camera transition was cancelled  #15460

@julianrex

Description

@julianrex

If one of

  • _setVisibleCoordinates:count:edgePadding:direction:duration:animationTimingFunction:completionHandler:
  • _setCenterCoordinate:edgePadding:zoomLevel:direction:duration:animationTimingFunction:completionHandler:
  • setCamera:withDuration:animationTimingFunction:edgePadding:completionHandler:
  • _flyToCamera:edgePadding:withDuration:peakAltitude:completionHandler:

is interrupted, for example by a pan gesture, then its completion block is correctly called. However, it's currently impossible to tell that this transition was cancelled. If you check cameraChangeReasonBitmask during the completion block, you'll see that MGLCameraChangeReasonTransitionCancelled is not set.

This is because the completion block is called from a dispatch_async, and by the time the completion block is called the bit mask has been changed.

Ideally, the completion block should take a parameter from which the user could determine whether it had been cancelled (a BOOL, or perhaps some kind of transition state object). This will change the API, so I'm marking as a SEMVER-MAJOR change - however, we can improve the situation by doing some cameraChangeReasonBitmask dancing (though this should only be viewed as a short-term measure).

iOS SDK: ios-v5.3.0-beta.1 (and earlier)
Discovered during testing of #15122.

Metadata

Metadata

Assignees

No one assigned

    Labels

    SEMVER-MAJORRequires a major release according to Semantic Versioning rulesiOSMapbox Maps SDK for iOS

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions