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
Labels
iOS
Mapbox Maps SDK for iOS
SEMVER-MAJOR
Requires a major release according to Semantic Versioning rules
Milestone
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 thatMGLCameraChangeReasonTransitionCancelled
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.
The text was updated successfully, but these errors were encountered: