summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjmkiley <jordan.kiley@mapbox.com>2019-07-12 13:02:05 -0700
committerjmkiley <jordan.kiley@mapbox.com>2019-08-02 13:13:08 -0700
commit95b8a1557465fd0e6dac60a1b43f40c32ecb4407 (patch)
treef4a30e78687c499f48efe13a42ae0eb36f77c3e7
parentbd6bc193c56e770635d547ca71a223256fd38690 (diff)
downloadqtlocation-mapboxgl-95b8a1557465fd0e6dac60a1b43f40c32ecb4407.tar.gz
[ios] Convert radians to degrees, es, added some notes
-rw-r--r--platform/ios/app/MBXAppDelegate.m2
-rw-r--r--platform/ios/src/MGLMapView.mm41
2 files changed, 12 insertions, 31 deletions
diff --git a/platform/ios/app/MBXAppDelegate.m b/platform/ios/app/MBXAppDelegate.m
index 519c70766a..5e1e82e178 100644
--- a/platform/ios/app/MBXAppDelegate.m
+++ b/platform/ios/app/MBXAppDelegate.m
@@ -11,7 +11,7 @@
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#ifndef MGL_DISABLE_LOGGING
- [MGLLoggingConfiguration sharedConfiguration].loggingLevel = MGLLoggingLevelFault;
+ [MGLLoggingConfiguration sharedConfiguration].loggingLevel = MGLLoggingLevelNone;
#endif
[MGLMetricsManager sharedManager].delegate = self;
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index 30cac91cca..eebb8c68e1 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -215,8 +215,6 @@ public:
@property (nonatomic) UIRotationGestureRecognizer *rotate;
@property (nonatomic) UILongPressGestureRecognizer *quickZoom;
@property (nonatomic) UIPanGestureRecognizer *twoFingerDrag;
-// jk
-@property (nonatomic) NSMutableArray<UIGestureRecognizer *> *activeGestureRecognizers;
@property (nonatomic) UIInterfaceOrientation currentOrientation;
@property (nonatomic) UIInterfaceOrientationMask applicationSupportedInterfaceOrientations;
@@ -609,8 +607,6 @@ public:
[_singleTapGestureRecognizer requireGestureRecognizerToFail:_quickZoom];
[self addGestureRecognizer:_singleTapGestureRecognizer];
- _activeGestureRecognizers = [[NSMutableArray alloc] init];
-
// observe app activity
//
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(willTerminate) name:UIApplicationWillTerminateNotification object:nil];
@@ -1623,12 +1619,11 @@ public:
MGLMapCamera *oldCamera = self.camera;
self.cameraChangeReasonBitmask |= MGLCameraChangeReasonGesturePinch;
-
+
if (pinch.state == UIGestureRecognizerStateBegan)
{
self.scale = powf(2, [self zoomLevel]);
- [self.activeGestureRecognizers addObject:pinch];
[self notifyGestureDidBegin];
}
else if (pinch.state == UIGestureRecognizerStateChanged)
@@ -1657,7 +1652,6 @@ public:
}
else if (pinch.state == UIGestureRecognizerStateEnded || pinch.state == UIGestureRecognizerStateCancelled)
{
- [self.activeGestureRecognizers removeObject:pinch];
CGFloat velocity = pinch.velocity;
if (isnan(velocity))
@@ -1719,16 +1713,17 @@ public:
if ( ! self.isRotateEnabled) return;
[self cancelTransitions];
- // jk - Detect which gesture is happening more/simulataneously
- // jk - this makes the annotations rotation while the map does not.
- self.currentRotation += abs(rotate.rotation);
- if ( self.currentRotation < 30 ) {
- NSLog(@"%f", rotate.rotation);
+
+
+ // custom gesture recognizer? we need to delay the gesture recognizer. I could set a threshold for the recognizer, and once it has been met keep going.
+ // Why shouldn't I concatenate the rotation value? What bad thing happens? Help...
+
+ if ( MGLDegreesFromRadians(self.currentRotation) < 30) {
rotate.delaysTouchesBegan = YES;
+ self.currentRotation += abs(rotate.rotation);
rotate.rotation = 0;
- NSLog(@"currentrotation %f", self.currentRotation);
- return;
}
+
CGPoint centerPoint = [self anchorPointForGesture:rotate];
MGLMapCamera *oldCamera = self.camera;
@@ -1736,6 +1731,7 @@ public:
if (rotate.state == UIGestureRecognizerStateBegan)
{
+
self.angle = MGLRadiansFromDegrees(*self.mbglMap.getCameraOptions().bearing) * -1;
if (self.userTrackingMode != MGLUserTrackingModeNone)
@@ -1744,24 +1740,10 @@ public:
}
self.shouldTriggerHapticFeedbackForCompass = NO;
- [self.activeGestureRecognizers addObject:rotate];
[self notifyGestureDidBegin];
}
else if (rotate.state == UIGestureRecognizerStateChanged)
{
- if (self.mbglMap.isRotating()) {
- NSLog(@"MAP IS SCALING JK");
- }
- /* jk - once map view does start rotating, it is jumpy. Also, this happens whenever I rotate, not just when zooming.
- The delay should only happen if a rotate starts while zooming.
- */
-// self.currentRotation += self.rotate.rotation;
-// if ( std::abs(self.currentRotation) < 3 && [self.activeGestureRecognizers containsObject:self.pinch]) {
-// NSLog(@"ROTATION: %f", rotate.rotation);
-// rotate.delaysTouchesBegan = YES;
-// return;
-// }
-
CGFloat newDegrees = MGLDegreesFromRadians(self.angle + rotate.rotation) * -1;
// constrain to +/-30 degrees when merely rotating like Apple does
@@ -1802,11 +1784,10 @@ public:
}
else if (rotate.state == UIGestureRecognizerStateEnded || rotate.state == UIGestureRecognizerStateCancelled)
{
- [self.activeGestureRecognizers removeObject:rotate];
CGFloat velocity = rotate.velocity;
CGFloat decelerationRate = self.decelerationRate;
self.currentRotation = 0;
-
+
if (decelerationRate != MGLMapViewDecelerationRateImmediate && fabs(velocity) > 3)
{
CGFloat radians = self.angle + rotate.rotation;