Explorar el Código

Fix for getting undefined on keyup event. (#9801)

Dave Solares hace 4 años
padre
commit
93a063e330
Se han modificado 1 ficheros con 5 adiciones y 0 borrados
  1. 5 0
      src/DeviceInput/deviceInputSystem.ts

+ 5 - 0
src/DeviceInput/deviceInputSystem.ts

@@ -282,6 +282,11 @@ export class DeviceInputSystem implements IDisposable {
         });
 
         this._keyboardUpEvent = ((evt) => {
+            if (!this._keyboardActive) {
+                this._keyboardActive = true;
+                this._registerDevice(DeviceType.Keyboard, 0, DeviceInputSystem._MAX_KEYCODES);
+            }
+
             const kbKey = this._inputs[DeviceType.Keyboard][0];
             if (kbKey) {
                 kbKey[evt.keyCode] = 0;