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

[ios] Fix pinch drift ignoring delegate camera change response #11423

Merged
merged 2 commits into from
Mar 12, 2018

Conversation

friedbunny
Copy link
Contributor

Fixes #11422, where the pinch gesture could drift beyond the bounds imposed by -[MGLMapViewDelegate mapView:shouldChangeFromCamera:toCamera:].

This doesn’t add a unit test, but does add a debug option to iosapp.

/cc @julianrex @fabian-guerra @lilykaiser

@friedbunny friedbunny added bug iOS Mapbox Maps SDK for iOS labels Mar 8, 2018
@friedbunny friedbunny added this to the ios-v3.7.6 milestone Mar 8, 2018
@friedbunny friedbunny self-assigned this Mar 8, 2018
@@ -1459,10 +1459,12 @@ - (void)handlePinchGesture:(UIPinchGestureRecognizer *)pinch
double zoom = log2(newScale);
MGLMapCamera *toCamera = [self cameraByZoomingToZoomLevel:zoom aroundAnchorPoint:centerPoint];

if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera])
if ( ! [self _shouldChangeFromCamera:oldCamera toCamera:toCamera])
Copy link
Contributor Author

@friedbunny friedbunny Mar 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is (obviously) the key line — if the response from the delegate is NO we shouldn’t drift. Previously, this would always allow drifting because, if the delegate responded NO it would move on to the following else.

@friedbunny friedbunny force-pushed the fb-fix-camera-limit-pinch-drift branch from 944e6f8 to e690e7c Compare March 8, 2018 22:13
@friedbunny friedbunny merged commit e690e7c into release-agua Mar 12, 2018
@friedbunny friedbunny deleted the fb-fix-camera-limit-pinch-drift branch March 12, 2018 18:07
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants