mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-29 23:28:12 +08:00
Prevent modifier key repeat from bogging down the app on WIndows
Closes #767
This commit is contained in:
@@ -99,6 +99,9 @@ export function createInputManager(editor: Editor, container: HTMLElement, dialo
|
|||||||
async function onKeyDown(e: KeyboardEvent): Promise<void> {
|
async function onKeyDown(e: KeyboardEvent): Promise<void> {
|
||||||
const key = await getLocalizedScanCode(e);
|
const key = await getLocalizedScanCode(e);
|
||||||
|
|
||||||
|
const NO_KEY_REPEAT_MODIFIER_KEYS = ["ControlLeft", "ControlRight", "ShiftLeft", "ShiftRight", "MetaLeft", "MetaRight", "AltLeft", "AltRight", "AltGraph", "CapsLock", "Fn", "FnLock"];
|
||||||
|
if (e.repeat && NO_KEY_REPEAT_MODIFIER_KEYS.includes(key)) return;
|
||||||
|
|
||||||
if (await shouldRedirectKeyboardEventToBackend(e)) {
|
if (await shouldRedirectKeyboardEventToBackend(e)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
const modifiers = makeKeyboardModifiersBitfield(e);
|
const modifiers = makeKeyboardModifiersBitfield(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user