Removed debug printing.

- Attempted to fix Key Combo bug blocking 'S' key.
This commit is contained in:
Christian Bastian
2024-08-08 20:42:34 -04:00
parent dc44112a2f
commit 6336f6e572

View File

@@ -64,7 +64,6 @@ class KeyComboListener {
const keyCodes = this.#keyCodes; const keyCodes = this.#keyCodes;
const combo = this.#combo; const combo = this.#combo;
if (keyCodes.includes(code) && !combo.includes(code)) { if (keyCodes.includes(code) && !combo.includes(code)) {
console.log(`COMBO ADD: ${code}, COMBO:${combo}`);
combo.push(code); combo.push(code);
} }
if (combo.length === 0 || keyCodes.length !== combo.length) { if (combo.length === 0 || keyCodes.length !== combo.length) {
@@ -76,13 +75,12 @@ class KeyComboListener {
} }
} }
if (document.activeElement !== this.element) { if (document.activeElement !== this.element) {
console.log("not active");
return; return;
} }
console.log("SAVE");
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.action(); this.action();
this.#combo.length = 0;
}); });
document.addEventListener("keyup", (e) => { document.addEventListener("keyup", (e) => {
// Mac keyup doesn't fire when meta key is held: https://stackoverflow.com/a/73419500 // Mac keyup doesn't fire when meta key is held: https://stackoverflow.com/a/73419500