From e4d32b5cbef17fc5dd97d54a84e2cca2dfc002dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20Nguye=CC=82=CC=83n?= Date: Mon, 9 May 2016 13:11:03 -0700 Subject: [PATCH] [osx] Removed two-finger tap zoom-out gesture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As in MapKit, a two-finger tap should be interpreted as a secondary click to open the context menu, if applicable. It should not zoom out; rather, a double-tap on a mouse should zoom out (“smart magnification”). --- platform/osx/src/MGLMapView.mm | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/platform/osx/src/MGLMapView.mm b/platform/osx/src/MGLMapView.mm index e06086cf3..d1356c6b4 100644 --- a/platform/osx/src/MGLMapView.mm +++ b/platform/osx/src/MGLMapView.mm @@ -394,10 +394,6 @@ public: clickGestureRecognizer.delaysPrimaryMouseButtonEvents = NO; [self addGestureRecognizer:clickGestureRecognizer]; - NSClickGestureRecognizer *secondaryClickGestureRecognizer = [[NSClickGestureRecognizer alloc] initWithTarget:self action:@selector(handleSecondaryClickGesture:)]; - secondaryClickGestureRecognizer.buttonMask = 0x2; - [self addGestureRecognizer:secondaryClickGestureRecognizer]; - NSClickGestureRecognizer *doubleClickGestureRecognizer = [[NSClickGestureRecognizer alloc] initWithTarget:self action:@selector(handleDoubleClickGesture:)]; doubleClickGestureRecognizer.numberOfClicksRequired = 2; doubleClickGestureRecognizer.delaysPrimaryMouseButtonEvents = NO; @@ -1362,18 +1358,6 @@ public: } } -/// Tap with two fingers (“right-click”) to zoom out. -- (void)handleSecondaryClickGesture:(NSClickGestureRecognizer *)gestureRecognizer { - if (!self.zoomEnabled || gestureRecognizer.state != NSGestureRecognizerStateEnded) { - return; - } - - _mbglMap->cancelTransitions(); - - NSPoint gesturePoint = [gestureRecognizer locationInView:self]; - [self scaleBy:0.5 atPoint:gesturePoint animated:YES]; -} - /// Double-click or double-tap to zoom in. - (void)handleDoubleClickGesture:(NSClickGestureRecognizer *)gestureRecognizer { if (!self.zoomEnabled || gestureRecognizer.state != NSGestureRecognizerStateEnded @@ -1394,6 +1378,7 @@ public: _mbglMap->cancelTransitions(); + // Tap with two fingers (“right-click”) to zoom out on mice but not trackpads. NSPoint gesturePoint = [self convertPoint:event.locationInWindow fromView:nil]; [self scaleBy:0.5 atPoint:gesturePoint animated:YES]; }