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

Ensure consistent willChange/didChange callbacks - #3086

Merged
1ec5 merged 2 commits into
masterfrom
1ec5-did-change-after-changing-3062
Nov 25, 2015
Merged

1ec5 merged 2 commits into
masterfrom
1ec5-did-change-after-changing-3062

Conversation

@1ec5

@1ec5 1ec5 commented Nov 20, 2015

Copy link
Copy Markdown
Contributor

Coalescing willChange/didChange callbacks means keeping track of how many gestures are currently in progress; by contrast, tracking this state with a boolean opens the door to many race conditions. This change refactors the gesture recognizers, making them more consistent with each other, more consistent in the case where more than one of them has fired, and a whole lot easier to reason about. It also explicitly cancels transitions before all programmatic viewport-modifying methods, since mbgl only does so when animating.

Two behavioral changes result from this PR:

  • When the map automatically rotates back to 0° at low zoom levels, that animation gets a separate willChange/didChange pair. Coalescing the two pairs will be possible again once we implement Animated MGLMapView methods should accept completion handlers #1581.
  • Drift-panning, drift-zooming, etc. result in an didChange callbacks, contrary to MapKit but consistent with MapKit’s documentation.

This PR also updates the tests to rely on didChange callbacks instead of timers. It wasn’t possible to do so before, because didChange would be called immediately after willChange (and before any animation) about half the time. This change should prevent the rotation test cases from flip-flopping going forward.

Fixes #2204, fixes #2313, fixes #2379, fixes #3062. Related to #2775.

/cc @friedbunny @incanus

@1ec5 1ec5 added bug iOS Mapbox Maps SDK for iOS tests labels Nov 20, 2015
@1ec5 1ec5 self-assigned this Nov 20, 2015
@1ec5 1ec5 added this to the ios-v3.1.0 milestone Nov 20, 2015
@incanus

incanus commented Nov 24, 2015

Copy link
Copy Markdown
Contributor

If you would consider this bug fixes @1ec5, please move to 3.0.1 milestone since that's definitely happening, otherwise we can hit it later in 3.1.0 with some other features.

1ec5 added 2 commits November 25, 2015 14:39
Coalescing willChange/didChange notifications means keeping track of how many gestures are currently in progress; a boolean isn’t enough to track this state. This change refactors the gesture recognizers, making them more consistent with each other and more consistent in the case where more than one of them has fired. It also explicitly cancels transitions before all programmatic viewport-modifying methods, since mbgl only does so when animating.

Fixes #2313, fixes #2379, fixes #3062.
@1ec5
1ec5 force-pushed the 1ec5-did-change-after-changing-3062 branch from 9370290 to e3992c4 Compare November 25, 2015 22:39
@1ec5
1ec5 merged commit e3992c4 into master Nov 25, 2015
@1ec5 1ec5 removed the in progress label Nov 25, 2015
@1ec5
1ec5 deleted the 1ec5-did-change-after-changing-3062 branch November 25, 2015 23:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug iOS Mapbox Maps SDK for iOS tests

Projects

None yet

2 participants