summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmkiley <jordan.kiley@mapbox.com>2019-09-04 10:34:04 -0700
committerjmkiley <jordan.kiley@mapbox.com>2019-09-04 10:34:04 -0700
commit021aab77cff99b8ccf8071f5774121e5baaaa288 (patch)
treec2d8d2bea05de5985539d80e7dbd63c681fecc8d
parenta691db5343c07c434bba44558c207d9900a04192 (diff)
downloadqtlocation-mapboxgl-021aab77cff99b8ccf8071f5774121e5baaaa288.tar.gz
[ios] remove feature flag for rotation threshold
-rw-r--r--platform/ios/src/MGLMapView.mm101
1 files changed, 1 insertions, 100 deletions
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 2eafea1dd9..f0e8faa936 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -583,6 +583,7 @@ public:
_rotate.delegate = self;
[self addGestureRecognizer:_rotate];
_rotateEnabled = YES;
+ _rotationThresholdWhileZooming = 3.5;
_doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleTapGesture:)];
_doubleTap.numberOfTapsRequired = 2;
@@ -1774,106 +1775,6 @@ public:
{
if ( ! self.isRotateEnabled) return;
- if ([[NSUserDefaults standardUserDefaults] objectForKey:MGLRotationThresholdWhileZoomingKey]) {
- [self handleRotateGestureRecognizerWithThreshold:rotate];
- } else {
- [self cancelTransitions];
-
- CGPoint centerPoint = [self anchorPointForGesture:rotate];
- MGLMapCamera *oldCamera = self.camera;
-
- self.cameraChangeReasonBitmask |= MGLCameraChangeReasonGestureRotate;
-
- if (rotate.state == UIGestureRecognizerStateBegan)
- {
- self.angle = MGLRadiansFromDegrees(*self.mbglMap.getCameraOptions().bearing) * -1;
-
- self.isRotating = YES;
- if (self.userTrackingMode != MGLUserTrackingModeNone)
- {
- self.userTrackingMode = MGLUserTrackingModeFollow;
- }
-
- self.shouldTriggerHapticFeedbackForCompass = NO;
- [self notifyGestureDidBegin];
- }
- if (rotate.state == UIGestureRecognizerStateChanged)
- {
- CGFloat newDegrees = MGLDegreesFromRadians(self.angle + rotate.rotation) * -1;
-
- // constrain to +/-30 degrees when merely rotating like Apple does
- //
- if ( ! self.isRotationAllowed && std::abs(self.pinch.scale) < 10)
- {
- newDegrees = fminf(newDegrees, 30);
- newDegrees = fmaxf(newDegrees, -30);
- }
-
- MGLMapCamera *toCamera = [self cameraByRotatingToDirection:newDegrees aroundAnchorPoint:centerPoint];
-
- if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera])
- {
- self.mbglMap.jumpTo(mbgl::CameraOptions()
- .withBearing(newDegrees)
- .withAnchor(mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y}));
- }
-
- [self cameraIsChanging];
-
- // Trigger a light haptic feedback event when the user rotates to due north.
- if (@available(iOS 10.0, *))
- {
- if (self.isHapticFeedbackEnabled && fabs(newDegrees) <= 1 && self.shouldTriggerHapticFeedbackForCompass)
- {
- UIImpactFeedbackGenerator *hapticFeedback = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleLight];
- [hapticFeedback impactOccurred];
-
- self.shouldTriggerHapticFeedbackForCompass = NO;
- }
- else if (fabs(newDegrees) > 1)
- {
- self.shouldTriggerHapticFeedbackForCompass = YES;
- }
- }
- }
- else if ((rotate.state == UIGestureRecognizerStateEnded || rotate.state == UIGestureRecognizerStateCancelled))
- {
- CGFloat velocity = rotate.velocity;
- CGFloat decelerationRate = self.decelerationRate;
- if (decelerationRate != MGLMapViewDecelerationRateImmediate && fabs(velocity) > 3)
- {
- CGFloat radians = self.angle + rotate.rotation;
- CGFloat newRadians = radians + velocity * decelerationRate * 0.1;
- CGFloat newDegrees = MGLDegreesFromRadians(newRadians) * -1;
-
- MGLMapCamera *toCamera = [self cameraByRotatingToDirection:newDegrees aroundAnchorPoint:centerPoint];
-
- if ([self _shouldChangeFromCamera:oldCamera toCamera:toCamera])
- {
- self.mbglMap.easeTo(mbgl::CameraOptions()
- .withBearing(newDegrees)
- .withAnchor(mbgl::ScreenCoordinate { centerPoint.x, centerPoint.y }),
- MGLDurationFromTimeInterval(decelerationRate));
-
- [self notifyGestureDidEndWithDrift:YES];
- __weak MGLMapView *weakSelf = self;
-
- [self animateWithDelay:decelerationRate animations:^
- {
- [weakSelf unrotateIfNeededForGesture];
- }];
- }
- }
- else
- {
- [self notifyGestureDidEndWithDrift:NO];
- [self unrotateIfNeededForGesture];
- }
- }
- }
-}
-
-- (void)handleRotateGestureRecognizerWithThreshold:(UIRotationGestureRecognizer *)rotate {
[self cancelTransitions];
CGPoint centerPoint = [self anchorPointForGesture:rotate];