Commit df49a727 authored by pythongosssss's avatar pythongosssss
Browse files

Fix modifiers triggering key down checks

parent 56d9496b
......@@ -106,6 +106,7 @@ const bindInput = (activeEl) => {
}
};
let keyIgnored = false;
window.addEventListener(
"keydown",
(e) => {
......@@ -116,6 +117,9 @@ window.addEventListener(
return;
}
keyIgnored = e.key === "Control" || e.key === "Shift" || e.key === "Alt" || e.key === "Meta";
if (keyIgnored) return;
// Check if this is a ctrl+z ctrl+y
if (await undoRedo(e)) return;
......@@ -127,6 +131,13 @@ window.addEventListener(
true
);
window.addEventListener("keyup", (e) => {
if (keyIgnored) {
keyIgnored = false;
checkState();
}
});
// Handle clicking DOM elements (e.g. widgets)
window.addEventListener("mouseup", () => {
checkState();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment