summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2019-08-22 10:43:19 -0700
committerFabian Guerra <fabian.guerra@mapbox.com>2019-08-22 10:45:44 -0700
commit28cce39bc716e0abba06b7e112ea438f616ee88b (patch)
tree626e93b9e9e9ea7df35f2f50bae9b5ce5838dc16
parent71a288e880fc80abbd3ae465fd53d5248f9b0a4f (diff)
downloadqtlocation-mapboxgl-28cce39bc716e0abba06b7e112ea438f616ee88b.tar.gz
[ios] Fix a delay at the beginning of the drag gesture.
-rw-r--r--platform/ios/src/MGLMapView.mm12
1 files changed, 7 insertions, 5 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 0794439ffd..821af62ece 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -268,7 +268,7 @@ public:
@property (nonatomic, copy) NSURL *residualStyleURL;
/// Tilt gesture recognizer helper
-@property (nonatomic, assign) CGPoint dragGestureMidPoint;
+@property (nonatomic, assign) CGPoint dragGestureMiddlePoint;
- (mbgl::Map &)mbglMap;
@@ -2142,7 +2142,9 @@ public:
if (twoFingerDrag.state == UIGestureRecognizerStateBegan)
{
- self.dragGestureMidPoint = [twoFingerDrag translationInView:twoFingerDrag.view];
+ CGPoint midPoint = [twoFingerDrag translationInView:twoFingerDrag.view];
+ // Creates an angle at the beginning of the gesture
+ self.dragGestureMiddlePoint = CGPointMake(midPoint.x, midPoint.y-1);
initialPitch = *self.mbglMap.getCameraOptions().pitch;
[self notifyGestureDidBegin];
}
@@ -2161,8 +2163,8 @@ public:
CGPoint middlePoint = [twoFingerDrag translationInView:twoFingerDrag.view];
- CLLocationDegrees gestureSlopeAngle = [self angleBetweenPoints:self.dragGestureMidPoint endPoint:middlePoint];
- self.dragGestureMidPoint = middlePoint;
+ CLLocationDegrees gestureSlopeAngle = [self angleBetweenPoints:self.dragGestureMiddlePoint endPoint:middlePoint];
+ self.dragGestureMiddlePoint = middlePoint;
if (fabs(fingerSlopeAngle) < 45 && fabs(gestureSlopeAngle) > 60 ) {
CGFloat gestureDistance = CGPoint([twoFingerDrag translationInView:twoFingerDrag.view]).y;
@@ -2192,7 +2194,7 @@ public:
{
[self notifyGestureDidEndWithDrift:NO];
[self unrotateIfNeededForGesture];
- self.dragGestureMidPoint = CGPointZero;
+ self.dragGestureMiddlePoint = CGPointZero;
}
}