From 555f3e04af473d7b3a3bcd6ce443d0c2e290c4ca Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Wed, 19 Jun 2019 14:21:59 -0700 Subject: [PATCH 1/2] [ios] Require two fingers for duration of tilt gesture --- platform/ios/CHANGELOG.md | 4 ++++ platform/ios/src/MGLMapView.mm | 2 ++ 2 files changed, 6 insertions(+) diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index d6583d277a9..01d70385ac9 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -2,6 +2,10 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONTRIBUTING.md](../../CONTRIBUTING.md) to get started. +## 5.2.0 + +* Fixed an issue where the two-finger tilt gesture would continue after lifting one finger. ([#14969](https://github.com/mapbox/mapbox-gl-native/pull/14969)) + ## 5.1.0 - June 19, 2019 ### Styles and rendering diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 85a2e3be927..8f34e800834 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2049,6 +2049,8 @@ - (void)handleTwoFingerDragGesture:(UIPanGestureRecognizer *)twoFingerDrag { if ( ! self.isPitchEnabled) return; + if (twoFingerDrag.numberOfTouches != 2) return; + [self cancelTransitions]; self.cameraChangeReasonBitmask |= MGLCameraChangeReasonGestureTilt; From eb88c6f84e44cac3af4082ab05a0ec0e89dc223c Mon Sep 17 00:00:00 2001 From: Jason Wray Date: Wed, 19 Jun 2019 15:48:26 -0700 Subject: [PATCH 2/2] End gesture, don't return indefinitely --- platform/ios/src/MGLMapView.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm index 8f34e800834..9693e3cff92 100644 --- a/platform/ios/src/MGLMapView.mm +++ b/platform/ios/src/MGLMapView.mm @@ -2049,8 +2049,6 @@ - (void)handleTwoFingerDragGesture:(UIPanGestureRecognizer *)twoFingerDrag { if ( ! self.isPitchEnabled) return; - if (twoFingerDrag.numberOfTouches != 2) return; - [self cancelTransitions]; self.cameraChangeReasonBitmask |= MGLCameraChangeReasonGestureTilt; @@ -2064,6 +2062,12 @@ - (void)handleTwoFingerDragGesture:(UIPanGestureRecognizer *)twoFingerDrag if (twoFingerDrag.state == UIGestureRecognizerStateBegan || twoFingerDrag.state == UIGestureRecognizerStateChanged) { + if (twoFingerDrag.numberOfTouches != 2) + { + twoFingerDrag.state = UIGestureRecognizerStateEnded; + return; + } + CGFloat gestureDistance = CGPoint([twoFingerDrag translationInView:twoFingerDrag.view]).y; CGFloat slowdown = 2.0;