Fix alt + shift keyboard shortcuts (#2053)

Fixes keyboard shortcuts that use `alt + shift` modifier (distribute
horizontally and vertically fall into this category).

Fixes [#2054](https://github.com/tldraw/tldraw/issues/2054)

### Change Type

- [x] `patch` — Bug fix

### Test Plan

1. Create multiple shapes
2. Use `alt + shift + v / h` to distribute vertically or horizontally.

### Release Notes

- Fixes keyboard shortcuts that use `alt` and `shift` modifiers.
This commit is contained in:
Mitja Bezenšek 2023-10-10 13:22:36 +02:00 committed by GitHub
parent 8892176b1a
commit f16bad666a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -82,7 +82,11 @@ function getHotkeysStringFromKbd(kbd: string) {
if (chars[0] === '!') { if (chars[0] === '!') {
str = `shift+${chars[1]}` str = `shift+${chars[1]}`
} else if (chars[0] === '?') { } else if (chars[0] === '?') {
if (chars.length === 3 && chars[1] === '!') {
str = `alt+shift+${chars[2]}`
} else {
str = `alt+${chars[1]}` str = `alt+${chars[1]}`
}
} else if (chars[0] === '$') { } else if (chars[0] === '$') {
if (chars[1] === '!') { if (chars[1] === '!') {
str = `cmd+shift+${chars[2]},ctrl+shift+${chars[2]}` str = `cmd+shift+${chars[2]},ctrl+shift+${chars[2]}`