summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Guerra <fabian.guerra@mapbox.com>2019-08-23 17:05:45 -0700
committerFabian Guerra <fabian.guerra@mapbox.com>2019-08-23 17:05:45 -0700
commit143feac6a2e1e8c271a2906ecf57aefa66150c0d (patch)
treeca39c4c42acfe25e6d1744d038ba0404e8311037
parent2ebc6039f5f8129d73351fe16d754c5ad1ebf8d8 (diff)
downloadqtlocation-mapboxgl-upstream/fabian-gesture-11982.tar.gz
[ios] Add comments to clarify the tilt gesture initialization.upstream/fabian-gesture-11982
-rw-r--r--platform/ios/src/MGLMapView.mm7
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 86017c9fbd..3fc692f4e0 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -2146,7 +2146,12 @@ public:
if (twoFingerDrag.state == UIGestureRecognizerStateBegan)
{
CGPoint midPoint = [twoFingerDrag translationInView:twoFingerDrag.view];
- // Creates an angle at the beginning of the gesture
+ // In the following if and for the first execution middlePoint
+ // will be equal to dragGestureMiddlePoint and the resulting
+ // gestureSlopeAngle will be 0º causing a small delay,
+ // initializing dragGestureMiddlePoint with the current midPoint
+ // but substracting one point from 'y' forces an initial 90º angle
+ // making the gesture avoid the delay
self.dragGestureMiddlePoint = CGPointMake(midPoint.x, midPoint.y-1);
initialPitch = *self.mbglMap.getCameraOptions().pitch;
[self notifyGestureDidBegin];