Browse Source

Fixed an dispose bug with input.gamepad.ts

David Catuhe 9 năm trước cách đây
mục cha
commit
9a5430337f
1 tập tin đã thay đổi với 4 bổ sung2 xóa
  1. 4 2
      src/Cameras/Inputs/babylon.freecamera.input.gamepad.ts

+ 4 - 2
src/Cameras/Inputs/babylon.freecamera.input.gamepad.ts

@@ -15,8 +15,10 @@ module BABYLON {
             this._gamepads = new Gamepads((gamepad: Gamepad) => { this._onNewGameConnected(gamepad); });
         }
         
-        detachControl(element : HTMLElement){
-            this._gamepads.dispose();
+        detachControl(element: HTMLElement) {
+            if (this._gamepads) {
+                this._gamepads.dispose();
+            }
             this.gamepad = null;
         }