123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- export var keys = {};
- export const KeyCode = {
- Escape: "Escape",
- F1: "F1",
- F2: "F2",
- F3: "F3",
- F4: "F4",
- F5: "F5",
- F6: "F6",
- F7: "F7",
- F8: "F8",
- F9: "F9",
- F10: "F10",
- F11: "F11",
- F12: "F12",
- Backquote: "Backquote",
- Digit1: "Digit1",
- Digit2: "Digit2",
- Digit3: "Digit3",
- Digit4: "Digit4",
- Digit5: "Digit5",
- Digit6: "Digit6",
- Digit7: "Digit7",
- Digit8: "Digit8",
- Digit9: "Digit9",
- Digit0: "Digit0",
- Minus: "Minus",
- Equal: "Equal",
- Backspace: "Backspace",
- Tab: "Tab",
- KeyQ: "KeyQ",
- KeyW: "KeyW",
- KeyE: "KeyE",
- KeyR: "KeyR",
- KeyT: "KeyT",
- KeyY: "KeyY",
- KeyU: "KeyU",
- KeyI: "KeyI",
- KeyO: "KeyO",
- KeyP: "KeyP",
- BracketLeft: "BracketLeft",
- BracketRight: "BracketRight",
- Backslash: "Backslash",
- CapsLock: "CapsLock",
- KeyA: "KeyA",
- KeyS: "KeyS",
- KeyD: "KeyD",
- KeyF: "KeyF",
- KeyG: "KeyG",
- KeyH: "KeyH",
- KeyJ: "KeyJ",
- KeyK: "KeyK",
- KeyL: "KeyL",
- Semicolon: "Semicolon",
- Quote: "Quote",
- Enter: "Enter",
- ShiftLeft: "ShiftLeft",
- KeyZ: "KeyZ",
- KeyX: "KeyX",
- KeyC: "KeyC",
- KeyV: "KeyV",
- KeyB: "KeyB",
- KeyN: "KeyN",
- KeyM: "KeyM",
- Comma: "Comma",
- Period: "Period",
- Slash: "Slash",
- ShiftRight: "ShiftRight",
- ControlLeft: "ControlLeft",
- AltLeft: "AltLeft",
- MetaLeft: "MetaLeft",
- Space: "Space",
- MetaRight: "MetaRight",
- AltRight: "AltRight",
- ArrowLeft: "ArrowLeft",
- ArrowUp: "ArrowUp",
- ArrowDown: "ArrowDown",
- ArrowRight: "ArrowRight",
- };
- window.addEventListener("keydown", onKeyDown);
- window.addEventListener("keyup", onKeyUp);
- function onKeyDown(event) {
- keys[event.code] = true;
- }
- function onKeyUp(event) {
- delete keys[event.code];
- }
|