[ios] Improve tilt gesture performance (#13902)

This commit is contained in:
Felix Wehnert
2019-02-12 02:28:44 +01:00
committed by Jason Wray
parent e1092e4148
commit 57438c2a7e
2 changed files with 6 additions and 4 deletions

View File

@@ -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

View File

@@ -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];