From 6a79eb6ded2f86a8062a72dbac58d53747d3847a Mon Sep 17 00:00:00 2001 From: Miodec Date: Tue, 28 Mar 2023 22:56:22 +0200 Subject: [PATCH 1/2] missing char --- frontend/static/layouts/_list.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/static/layouts/_list.json b/frontend/static/layouts/_list.json index 593c7a383..abe9590e0 100644 --- a/frontend/static/layouts/_list.json +++ b/frontend/static/layouts/_list.json @@ -311,7 +311,7 @@ "keymapShowTopRow": true, "type": "iso", "keys": { - "row1": ["^°", "1!", "2", "3§", "4$", "5%", "6&", "7/", "8(", "9)", "0=", "+*", "<>"], + "row1": ["^°", "1!", "2\"", "3§", "4$", "5%", "6&", "7/", "8(", "9)", "0=", "+*", "<>"], "row2": ["üÜ", ",;", ".:", "pP", "yY", "fF", "gG", "cC", "tT", "zZ", "ß?", "\\/"], "row3": ["aA", "oO", "eE", "iI", "uU", "hH", "dD", "rR", "nN", "sS", "lL", "-_"], "row4": ["äÄ", "öÖ", "qQ", "jJ", "kK", "xX", "bB", "mM", "wW", "vV", "#'"], From 4fe1f97c6629190181aa12cfd3afc27ce40889ad Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 29 Mar 2023 17:11:48 +0200 Subject: [PATCH 2/2] moved function calls to their own events returning if key is not tracked returning if key is already pressed (not tracking repeats) only pushing alpha numerics and space --- frontend/src/ts/controllers/input-controller.ts | 16 ++++++++++++---- frontend/src/ts/test/test-input.ts | 6 +++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/frontend/src/ts/controllers/input-controller.ts b/frontend/src/ts/controllers/input-controller.ts index 7d351f7b0..411bdacae 100644 --- a/frontend/src/ts/controllers/input-controller.ts +++ b/frontend/src/ts/controllers/input-controller.ts @@ -834,9 +834,6 @@ $(document).keydown(async (event) => { } TestInput.recordKeypressSpacing(); TestInput.setKeypressDuration(performance.now()); - setTimeout(() => { - TestInput.recordKeydownTime(event.code); - }, 0); TestInput.setKeypressNotAfk(); //blocking firefox from going back in history with backspace @@ -950,6 +947,18 @@ $(document).keydown(async (event) => { isBackspace = event.key === "Backspace" || event.key === "delete"; }); +$("#wordsInput").keydown((event) => { + setTimeout(() => { + TestInput.recordKeydownTime(event.code); + }, 0); +}); + +$("#wordsInput").keyup((event) => { + setTimeout(() => { + TestInput.recordKeyupTime(event.code); + }, 0); +}); + $("#wordsInput").keyup((event) => { if (!event.originalEvent?.isTrusted || TestUI.testRestarting) { event.preventDefault(); @@ -966,7 +975,6 @@ $("#wordsInput").keyup((event) => { ); TestInput.pushKeypressDuration(diff); } - TestInput.recordKeyupTime(event.code); TestInput.setKeypressDuration(now); Monkey.stop(); }); diff --git a/frontend/src/ts/test/test-input.ts b/frontend/src/ts/test/test-input.ts index 4b13b3a06..cdf05d67e 100644 --- a/frontend/src/ts/test/test-input.ts +++ b/frontend/src/ts/test/test-input.ts @@ -239,15 +239,19 @@ export function setKeypressDuration(val: number): void { let newKeypresDurationArray: number[] = []; export function recordKeyupTime(key: string): void { + if (keysObj[key] === undefined) return; const now = performance.now(); const diff = Math.abs(keysObj[key] - now); - newKeypresDurationArray.push(roundTo2(diff)); + if (/(Key[A-Z])|(Digit[0-9])|Space/.test(key)) { + newKeypresDurationArray.push(roundTo2(diff)); + } delete keysObj[key]; updateOverlap(); } export function recordKeydownTime(key: string): void { + if (keysObj[key] !== undefined) return; keysObj[key] = performance.now(); updateOverlap();