Keyboard shortcut tweaks
This commit is contained in:
parent
5d37c15173
commit
b3e4aca200
1 changed files with 10 additions and 1 deletions
|
@ -2,12 +2,17 @@ import {useEffect} from 'react'
|
||||||
import getStudio from '@theatre/studio/getStudio'
|
import getStudio from '@theatre/studio/getStudio'
|
||||||
import {cmdIsDown} from '@theatre/studio/utils/keyboardUtils'
|
import {cmdIsDown} from '@theatre/studio/utils/keyboardUtils'
|
||||||
import {getSelectedSequence} from '@theatre/studio/selectors'
|
import {getSelectedSequence} from '@theatre/studio/selectors'
|
||||||
|
import type {$IntentionalAny} from '@theatre/shared/utils/types'
|
||||||
|
|
||||||
export default function useKeyboardShortcuts() {
|
export default function useKeyboardShortcuts() {
|
||||||
const studio = getStudio()
|
const studio = getStudio()
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleKeyDown = (e: KeyboardEvent) => {
|
const handleKeyDown = (e: KeyboardEvent) => {
|
||||||
if (e.target && (e.target as HTMLElement).tagName === 'INPUT') {
|
const target: null | HTMLElement = e.target as unknown as $IntentionalAny
|
||||||
|
if (
|
||||||
|
target &&
|
||||||
|
(target.tagName === 'INPUT' || target.tagName === 'TEXTAREA')
|
||||||
|
) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +23,8 @@ export default function useKeyboardShortcuts() {
|
||||||
} else {
|
} else {
|
||||||
studio.undo()
|
studio.undo()
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
} else if (
|
} else if (
|
||||||
e.key === ' ' &&
|
e.key === ' ' &&
|
||||||
|
@ -33,6 +40,8 @@ export default function useKeyboardShortcuts() {
|
||||||
} else {
|
} else {
|
||||||
seq.play()
|
seq.play()
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in a new issue