Skip to content
This repository has been 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

Closed
julianrex opened this issue Aug 23, 2019 · 1 comment
Labels
iOS Mapbox Maps SDK for iOS SEMVER-MAJOR Requires a major release according to Semantic Versioning rules
Milestone

Comments

@julianrex
Copy link
Contributor

julianrex commented Aug 23, 2019

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.

@julianrex julianrex added iOS Mapbox Maps SDK for iOS SEMVER-MAJOR Requires a major release according to Semantic Versioning rules labels Aug 23, 2019
@julianrex julianrex changed the title [ios] Cannot determine whether camera transition was cancelled completion block [ios] Cannot determine in completion block whether camera transition was cancelled Aug 23, 2019
@chloekraw chloekraw added this to the ios-future milestone Aug 28, 2019
@julianrex
Copy link
Contributor Author

Closing as stale.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
iOS Mapbox Maps SDK for iOS SEMVER-MAJOR Requires a major release according to Semantic Versioning rules
Projects
None yet
Development

No branches or pull requests

2 participants