summaryrefslogtreecommitdiff
path: root/platform/ios
diff options
context:
space:
mode:
authorJason Wray <jason@mapbox.com>2017-06-28 13:05:12 -0400
committerJason Wray <jason@mapbox.com>2017-06-28 16:21:41 -0400
commit6aecc66fc876825e164675f745ca9c71000ce515 (patch)
treee3986c5561f020b90f0a1632411bfce14c3181de /platform/ios
parent361dda25a63b44d6be08fba91db891871b01e233 (diff)
downloadqtlocation-mapboxgl-6aecc66fc876825e164675f745ca9c71000ce515.tar.gz
[ios] Minimize tilt gesture delay
Diffstat (limited to 'platform/ios')
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/ios/src/MGLMapView.mm19
2 files changed, 11 insertions, 9 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 113d277806..c08952a664 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -46,6 +46,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
* The Improve This Map button in the attribution action sheet now leads to a feedback tool that matches MGLMapView’s rotation and pitch. `-[MGLAttributionInfo feedbackURLAtCenterCoordinate:zoomLevel:]` no longer respects the feedback URL specified in TileJSON. ([#9078](https://github.com/mapbox/mapbox-gl-native/pull/9078))
* `-[MGLMapViewDelegate mapView:shouldChangeFromCamera:toCamera:]` can now block any panning caused by a pinch gesture. ([#9344](https://github.com/mapbox/mapbox-gl-native/pull/9344))
* If the user taps on the map while it is flying to the user’s location, the user dot no longer appears in the incorrect location. ([#7916](https://github.com/mapbox/mapbox-gl-native/pull/7916))
+* Improved the responsiveness of the tilt gesture by reducing the initial recognition delay. ([#9386](https://github.com/mapbox/mapbox-gl-native/pull/9386))
### Other changes
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index ba37dc3d31..f3b0d8506a 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -532,21 +532,21 @@ public:
_singleTapGestureRecognizer.delegate = self;
[self addGestureRecognizer:_singleTapGestureRecognizer];
- _twoFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerTapGesture:)];
- _twoFingerTap.numberOfTouchesRequired = 2;
- [_twoFingerTap requireGestureRecognizerToFail:_pinch];
- [_twoFingerTap requireGestureRecognizerToFail:_rotate];
- [self addGestureRecognizer:_twoFingerTap];
-
_twoFingerDrag = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerDragGesture:)];
_twoFingerDrag.minimumNumberOfTouches = 2;
_twoFingerDrag.maximumNumberOfTouches = 2;
_twoFingerDrag.delegate = self;
- [_twoFingerDrag requireGestureRecognizerToFail:_twoFingerTap];
[_twoFingerDrag requireGestureRecognizerToFail:_pan];
[self addGestureRecognizer:_twoFingerDrag];
_pitchEnabled = YES;
+ _twoFingerTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTwoFingerTapGesture:)];
+ _twoFingerTap.numberOfTouchesRequired = 2;
+ [_twoFingerTap requireGestureRecognizerToFail:_pinch];
+ [_twoFingerTap requireGestureRecognizerToFail:_rotate];
+ [_twoFingerTap requireGestureRecognizerToFail:_twoFingerDrag];
+ [self addGestureRecognizer:_twoFingerTap];
+
_decelerationRate = MGLMapViewDecelerationRateNormal;
_quickZoom = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleQuickZoomGesture:)];
@@ -1682,14 +1682,14 @@ public:
if ( ! self.isPitchEnabled) return;
_mbglMap->cancelTransitions();
- MGLMapCamera *oldCamera = self.camera;
if (twoFingerDrag.state == UIGestureRecognizerStateBegan)
{
[self trackGestureEvent:MGLEventGesturePitchStart forRecognizer:twoFingerDrag];
[self notifyGestureDidBegin];
}
- else if (twoFingerDrag.state == UIGestureRecognizerStateBegan || twoFingerDrag.state == UIGestureRecognizerStateChanged)
+
+ if (twoFingerDrag.state == UIGestureRecognizerStateBegan || twoFingerDrag.state == UIGestureRecognizerStateChanged)
{
CGFloat gestureDistance = CGPoint([twoFingerDrag translationInView:twoFingerDrag.view]).y;
CGFloat currentPitch = _mbglMap->getPitch();
@@ -1699,6 +1699,7 @@ public:
CGPoint centerPoint = [self anchorPointForGesture:twoFingerDrag];
+ MGLMapCamera *oldCamera = self.camera;
MGLMapCamera *toCamera = [self cameraByTiltingToPitch:pitchNew];
if (![self.delegate respondsToSelector:@selector(mapView:shouldChangeFromCamera:toCamera:)] ||