Browse Source

Fixed an bug with Inputs/babylon.arcrotatecamera.input.gamepad.js

David Catuhe 9 năm trước cách đây
mục cha
commit
2aa256e0b2

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 12512 - 0
dist/preview release/Oimo.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 15 - 15
dist/preview release/babylon.core.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 1464 - 1464
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 21 - 21
dist/preview release/babylon.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 12 - 8
dist/preview release/babylon.max.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 20 - 20
dist/preview release/babylon.noworker.js


+ 3 - 1
src/Cameras/Inputs/babylon.arcrotatecamera.input.gamepad.js

@@ -16,7 +16,9 @@ var BABYLON;
             this._gamepads = new BABYLON.Gamepads(function (gamepad) { _this._onNewGameConnected(gamepad); });
         };
         ArcRotateCameraGamepadInput.prototype.detachControl = function (element) {
-            this._gamepads.dispose();
+            if (this._gamepads) {
+                this._gamepads.dispose();
+            }
             this.gamepad = null;
         };
         ArcRotateCameraGamepadInput.prototype.checkInputs = function () {

+ 4 - 2
src/Cameras/Inputs/babylon.arcrotatecamera.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;
         }
 

+ 8 - 6
src/Materials/Textures/babylon.videoTexture.js

@@ -31,12 +31,14 @@ var BABYLON;
                 _this._texture = scene.getEngine().createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, generateMipMaps, samplingMode, false);
                 _this._texture.isReady = true;
             });
-            urls.forEach(function (url) {
-                //Backwards-compatibility for typescript 1. from 1.3 it should say "SOURCE". see here - https://github.com/Microsoft/TypeScript/issues/1850
-                var source = document.createElement("source");
-                source.src = url;
-                _this.video.appendChild(source);
-            });
+            if (urls) {
+                urls.forEach(function (url) {
+                    //Backwards-compatibility for typescript 1. from 1.3 it should say "SOURCE". see here - https://github.com/Microsoft/TypeScript/issues/1850
+                    var source = document.createElement("source");
+                    source.src = url;
+                    _this.video.appendChild(source);
+                });
+            }
             this._lastUpdate = BABYLON.Tools.Now;
         }
         VideoTexture.prototype.update = function () {

+ 8 - 6
src/Materials/Textures/babylon.videoTexture.ts

@@ -28,12 +28,14 @@
                 this._texture.isReady = true;
             });
 
-            urls.forEach(url => {
-                //Backwards-compatibility for typescript 1. from 1.3 it should say "SOURCE". see here - https://github.com/Microsoft/TypeScript/issues/1850
-                var source = <HTMLSourceElement> document.createElement("source");
-                source.src = url;
-                this.video.appendChild(source);
-            });
+            if (urls) {
+                urls.forEach(url => {
+                    //Backwards-compatibility for typescript 1. from 1.3 it should say "SOURCE". see here - https://github.com/Microsoft/TypeScript/issues/1850
+                    var source = <HTMLSourceElement>document.createElement("source");
+                    source.src = url;
+                    this.video.appendChild(source);
+                });
+            }
 
             this._lastUpdate = Tools.Now;
         }