mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
hotkeys - check for code
This commit is contained in:
parent
d4aabf109e
commit
9aa0278f7e
1 changed files with 1 additions and 1 deletions
|
|
@ -4,7 +4,7 @@ document.addEventListener("keydown", handleKeydown);
|
|||
document.addEventListener("keyup", handleKeyup);
|
||||
|
||||
function handleKeydown(event) {
|
||||
const {key, ctrlKey, altKey} = event;
|
||||
const {key, code, ctrlKey, altKey} = event;
|
||||
if (altKey && !ctrlKey) event.preventDefault(); // disallow alt key combinations
|
||||
if (ctrlKey && ["KeyS", "KeyC"].includes(code)) event.preventDefault(); // disallow CTRL + S and CTRL + C
|
||||
if (["F1", "F2", "F6", "F9", "Tab"].includes(key)) event.preventDefault(); // disallow default Fn and Tab
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue