feat: add shortcut of zooming to selection (#9447)

### Changed
- change edgeless shortcut `cmd + 0`, `cmd + 1` to `alt + 0`, `alt + 1`
- add new shortcut `alt + 2` to zoom to currently selected elements
This commit is contained in:
doouding
2025-01-03 03:57:04 +00:00
parent 30a181da38
commit a4e94ab72f
8 changed files with 125 additions and 15 deletions

View File

@@ -16,6 +16,7 @@ type KeyboardShortcutsI18NKeys =
| 'zoomOut'
| 'zoomTo100'
| 'zoomToFit'
| 'zoomToSelection'
| 'select'
| 'text'
| 'shape'
@@ -114,8 +115,9 @@ export const useMacEdgelessKeyboardShortcuts = (): ShortcutMap => {
[t('redo')]: ['⌘', '⇧', 'Z'],
[t('zoomIn')]: ['⌘', '+'],
[t('zoomOut')]: ['⌘', '-'],
[t('zoomTo100')]: ['', '0'],
[t('zoomToFit')]: ['', '1'],
[t('zoomTo100')]: ['Alt', '0'],
[t('zoomToFit')]: ['Alt', '1'],
[t('zoomToSelection')]: ['Alt', '2'],
[t('select')]: ['V'],
[t('text')]: ['T'],
[t('shape')]: ['S'],
@@ -140,8 +142,9 @@ export const useWinEdgelessKeyboardShortcuts = (): ShortcutMap => {
[t('redo')]: ['Ctrl', 'Y/Ctrl', 'Shift', 'Z'],
[t('zoomIn')]: ['Ctrl', '+'],
[t('zoomOut')]: ['Ctrl', '-'],
[t('zoomTo100')]: ['Ctrl', '0'],
[t('zoomToFit')]: ['Ctrl', '1'],
[t('zoomTo100')]: ['Alt', '0'],
[t('zoomToFit')]: ['Alt', '1'],
[t('zoomToSelection')]: ['Alt', '2'],
[t('select')]: ['V'],
[t('text')]: ['T'],
[t('shape')]: ['S'],