* @param {KeyboardEvent} evt - https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent
(evt)
| 108 | * @param {KeyboardEvent} evt - https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent |
| 109 | */ |
| 110 | function onKeyDown(evt) { |
| 111 | if (overlayTracker.hasOverlays()) { |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | const canonicalCode = keystrokeToCanonicalCode(evt); |
| 116 | |
| 117 | if (isIgnoredKeystroke(canonicalCode)) { |
| 118 | return; |
| 119 | } |
| 120 | |
| 121 | keyboardState.onKeyDown(evt); |
| 122 | |
| 123 | if (!connectedToServer) { |
| 124 | return; |
| 125 | } |
| 126 | if (!evt.metaKey) { |
| 127 | evt.preventDefault(); |
| 128 | } |
| 129 | |
| 130 | const onScreenKeyboard = document.getElementById("on-screen-keyboard"); |
| 131 | |
| 132 | processKeystroke({ |
| 133 | metaLeft: |
| 134 | keyboardState.isKeyPressed("MetaLeft") || |
| 135 | onScreenKeyboard.isModifierKeyPressed("MetaLeft"), |
| 136 | metaRight: |
| 137 | keyboardState.isKeyPressed("MetaRight") || |
| 138 | onScreenKeyboard.isModifierKeyPressed("MetaRight"), |
| 139 | altLeft: |
| 140 | keyboardState.isKeyPressed("AltLeft") || |
| 141 | onScreenKeyboard.isModifierKeyPressed("AltLeft"), |
| 142 | altRight: |
| 143 | keyboardState.isKeyPressed("AltRight") || |
| 144 | onScreenKeyboard.isModifierKeyPressed("AltRight"), |
| 145 | shiftLeft: |
| 146 | keyboardState.isKeyPressed("ShiftLeft") || |
| 147 | onScreenKeyboard.isModifierKeyPressed("ShiftLeft"), |
| 148 | shiftRight: |
| 149 | keyboardState.isKeyPressed("ShiftRight") || |
| 150 | onScreenKeyboard.isModifierKeyPressed("ShiftRight"), |
| 151 | ctrlLeft: |
| 152 | keyboardState.isKeyPressed("ControlLeft") || |
| 153 | onScreenKeyboard.isModifierKeyPressed("ControlLeft"), |
| 154 | ctrlRight: |
| 155 | keyboardState.isKeyPressed("ControlRight") || |
| 156 | onScreenKeyboard.isModifierKeyPressed("ControlRight"), |
| 157 | key: evt.key, |
| 158 | code: canonicalCode, |
| 159 | }); |
| 160 | } |
| 161 | |
| 162 | function sendMouseEvent( |
| 163 | buttons, |
nothing calls this directly
no test coverage detected