summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Wehnert <flashspys@gmail.com>2019-02-12 02:28:44 +0100
committerJason Wray <friedbunny@users.noreply.github.com>2019-02-11 17:28:44 -0800
commit57438c2a7e2f7da1db386faef846cdbf121928fa (patch)
treef19271f230a1580de4784155ac09a51754656a13
parente1092e4148faddaa6c5ec23051f142503a50039c (diff)
downloadqtlocation-mapboxgl-57438c2a7e2f7da1db386faef846cdbf121928fa.tar.gz
[ios] Improve tilt gesture performance (#13902)
-rw-r--r--platform/ios/CHANGELOG.md1
-rw-r--r--platform/ios/src/MGLMapView.mm9
2 files changed, 6 insertions, 4 deletions
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 9b6f9da6e8..6a36e954c5 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -5,6 +5,7 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
## 4.9.0
* Fixed a bug where setting `MGLMapView.userTrackingMode` to `MGLUserTrackingModeFollowWithHeading` or `MGLUserTrackingModeFollowWithCourse` would be ignored if the user’s location was not already available. ([#13849](https://github.com/mapbox/mapbox-gl-native/pull/13849))
+* Improved tilt gesture performance. ([#13902](https://github.com/mapbox/mapbox-gl-native/pull/13902))
## 4.8.0 - January 30, 2019
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 2c10a606c0..1483d72074 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -1968,9 +1968,11 @@ public:
[self cancelTransitions];
self.cameraChangeReasonBitmask |= MGLCameraChangeReasonGestureTilt;
-
+ static CGFloat initialPitch;
+
if (twoFingerDrag.state == UIGestureRecognizerStateBegan)
{
+ initialPitch = self.mbglMap.getPitch();
[self trackGestureEvent:MMEEventGesturePitchStart forRecognizer:twoFingerDrag];
[self notifyGestureDidBegin];
}
@@ -1978,10 +1980,9 @@ public:
if (twoFingerDrag.state == UIGestureRecognizerStateBegan || twoFingerDrag.state == UIGestureRecognizerStateChanged)
{
CGFloat gestureDistance = CGPoint([twoFingerDrag translationInView:twoFingerDrag.view]).y;
- CGFloat currentPitch = self.mbglMap.getPitch();
- CGFloat slowdown = 20.0;
+ CGFloat slowdown = 2.0;
- CGFloat pitchNew = currentPitch - (gestureDistance / slowdown);
+ CGFloat pitchNew = initialPitch - (gestureDistance / slowdown);
CGPoint centerPoint = [self anchorPointForGesture:twoFingerDrag];