Add more keyboard shortcuts

Signed-off-by: Bento <bento@de-gier.eu>
This commit is contained in:
Fossil 2021-04-10 19:12:54 +02:00 committed by Alexander Borsuk
parent 8344e032cc
commit 58ee32a0c6

View file

@ -713,9 +713,14 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing";
}
- (NSArray *)keyCommands {
return @[[UIKeyCommand keyCommandWithInput:UIKeyInputDownArrow modifierFlags:0 action:@selector(zoomOut) discoverabilityTitle:@"Zoom Out"],
[UIKeyCommand keyCommandWithInput:UIKeyInputUpArrow modifierFlags:0 action:@selector(zoomIn) discoverabilityTitle:@"Zoom In"],
[UIKeyCommand keyCommandWithInput:UIKeyInputEscape modifierFlags:0 action:@selector(goBack) discoverabilityTitle:@"Go Back"]];
return @[[UIKeyCommand keyCommandWithInput:UIKeyInputDownArrow modifierFlags:0 action:@selector(zoomOut)], // Alternative, not shown when holding CMD
[UIKeyCommand keyCommandWithInput:@"-" modifierFlags:UIKeyModifierCommand action:@selector(zoomOut) discoverabilityTitle:@"Zoom Out"],
[UIKeyCommand keyCommandWithInput:UIKeyInputUpArrow modifierFlags:0 action:@selector(zoomIn)], // Alternative, not shown when holding CMD
[UIKeyCommand keyCommandWithInput:@"=" modifierFlags:UIKeyModifierCommand action:@selector(zoomIn)], // Alternative, not shown when holding CMD
[UIKeyCommand keyCommandWithInput:@"+" modifierFlags:UIKeyModifierCommand action:@selector(zoomIn) discoverabilityTitle:@"Zoom In"],
[UIKeyCommand keyCommandWithInput:UIKeyInputEscape modifierFlags:0 action:@selector(goBack) discoverabilityTitle:@"Go Back"],
[UIKeyCommand keyCommandWithInput:@"0" modifierFlags:UIKeyModifierCommand action:@selector(switchPositionMode) discoverabilityTitle:@"Switch position mode"]
];
}
- (void)zoomOut {
@ -726,6 +731,10 @@ NSString *const kPP2BookmarkEditingSegue = @"PP2BookmarkEditing";
GetFramework().Scale(Framework::SCALE_MAG, true);
}
- (void)switchPositionMode {
GetFramework().SwitchMyPositionNextMode();
}
- (void)goBack {
NSString *backURL = [DeepLinkHandler.shared getBackUrl];
BOOL canOpenURL = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:backURL]];