mirror of
https://codeberg.org/comaps/comaps
synced 2025-12-20 13:23:59 +00:00
[drape] Enable shift+swipe to zoom on macOS Catalyst app\
\ Matches functionality in Apple Maps. Discovered while discussing issue #1509\ \ Tested that pinch to zoom still work in iPad Simulator Signed-off-by: eisa01 <eisa01@gmail.com>
This commit is contained in:
@@ -908,6 +908,15 @@ NSString *const kAboutSegue = @"Map2About";
|
|||||||
CGPoint translation = [recognizer translationInView:self.view];
|
CGPoint translation = [recognizer translationInView:self.view];
|
||||||
if (translation.x == 0 && translation.y == 0 && CGPointEqualToPoint(translation, CGPointZero))
|
if (translation.x == 0 && translation.y == 0 && CGPointEqualToPoint(translation, CGPointZero))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
BOOL isShiftPressed = [recognizer modifierFlags] & UIKeyModifierShift;
|
||||||
|
|
||||||
|
if (isShiftPressed) {
|
||||||
|
self.userTouchesAction = UserTouchesActionScale;
|
||||||
|
static const CGFloat kScaleFactor = 0.9;
|
||||||
|
const CGFloat factor = translation.y > 0 ? kScaleFactor : 1 / kScaleFactor;
|
||||||
|
GetFramework().Scale(factor, [self getZoomPoint], false);
|
||||||
|
} else {
|
||||||
self.userTouchesAction = UserTouchesActionDrag;
|
self.userTouchesAction = UserTouchesActionDrag;
|
||||||
CGPoint velocity = [recognizer velocityInView:self.view];
|
CGPoint velocity = [recognizer velocityInView:self.view];
|
||||||
CGFloat velocityX = ABS(velocity.x * 0.001);
|
CGFloat velocityX = ABS(velocity.x * 0.001);
|
||||||
@@ -921,6 +930,7 @@ NSString *const kAboutSegue = @"Map2About";
|
|||||||
velocityY = 2.5;
|
velocityY = 2.5;
|
||||||
}
|
}
|
||||||
GetFramework().Scroll((translation.x * velocityX) * -1, (translation.y * velocityY) * -1);
|
GetFramework().Scroll((translation.x * velocityX) * -1, (translation.y * velocityY) * -1);
|
||||||
|
}
|
||||||
[recognizer setTranslation:CGPointZero inView:self.view];
|
[recognizer setTranslation:CGPointZero inView:self.view];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user