mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): ignore keyboard shortcuts in input/textarea elements
This commit is contained in:
parent
d8515b6efc
commit
ddfc8785b4
@ -501,11 +501,15 @@ export const setStageEventHandlers = ({
|
||||
if (e.repeat) {
|
||||
return;
|
||||
}
|
||||
// Cancel shape drawing on escape
|
||||
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
|
||||
return;
|
||||
}
|
||||
if (e.key === 'Escape') {
|
||||
// Cancel shape drawing on escape
|
||||
setIsDrawing(false);
|
||||
setLastMouseDownPos(null);
|
||||
} else if (e.key === ' ') {
|
||||
// Select the view tool on space key down
|
||||
setToolBuffer(getToolState().selected);
|
||||
setTool('view');
|
||||
} else if (e.key === 'r') {
|
||||
@ -527,11 +531,14 @@ export const setStageEventHandlers = ({
|
||||
window.addEventListener('keydown', onKeyDown);
|
||||
|
||||
const onKeyUp = (e: KeyboardEvent) => {
|
||||
// Cancel shape drawing on escape
|
||||
if (e.repeat) {
|
||||
return;
|
||||
}
|
||||
if (e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement) {
|
||||
return;
|
||||
}
|
||||
if (e.key === ' ') {
|
||||
// Revert the tool to the previous tool on space key up
|
||||
const toolBuffer = getToolState().selectedBuffer;
|
||||
setTool(toolBuffer ?? 'move');
|
||||
setToolBuffer(null);
|
||||
|
Loading…
Reference in New Issue
Block a user