Browse Source

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

Dave Solares 4 năm trước cách đây
mục cha
commit
93a063e330
1 tập tin đã thay đổi với 5 bổ sung0 xóa
  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;