Переглянути джерело

Merge remote-tracking branch 'refs/remotes/BabylonJS/master'

DESKTOP-QJU4N0L\mityh 8 роки тому
батько
коміт
fd45482c4d

Різницю між файлами не показано, бо вона завелика
+ 6264 - 6251
dist/preview release/babylon.d.ts


Різницю між файлами не показано, бо вона завелика
+ 25 - 25
dist/preview release/babylon.js


+ 66 - 17
dist/preview release/babylon.max.js

@@ -34314,16 +34314,25 @@ var BABYLON;
             this._onLostFocus = function () {
                 _this._keys = [];
             };
-            element.addEventListener("keydown", this._onKeyDown, false);
-            element.addEventListener("keyup", this._onKeyUp, false);
+            this._onFocus = function () {
+                element.addEventListener("keydown", _this._onKeyDown, false);
+                element.addEventListener("keyup", _this._onKeyUp, false);
+            };
+            this._onBlur = function () {
+                element.removeEventListener("keydown", _this._onKeyDown);
+                element.removeEventListener("keyup", _this._onKeyUp);
+            };
+            element.addEventListener("focus", this._onFocus);
+            element.addEventListener("blur", this._onBlur);
             BABYLON.Tools.RegisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
             ]);
         };
         ArcRotateCameraKeyboardMoveInput.prototype.detachControl = function (element) {
-            if (element) {
-                element.removeEventListener("keydown", this._onKeyDown);
-                element.removeEventListener("keyup", this._onKeyUp);
+            if (element && this._onBlur) {
+                this._onBlur();
+                element.removeEventListener("focus", this._onFocus);
+                element.removeEventListener("blur", this._onBlur);
             }
             BABYLON.Tools.UnregisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
@@ -34332,6 +34341,8 @@ var BABYLON;
             this._onKeyDown = null;
             this._onKeyUp = null;
             this._onLostFocus = null;
+            this._onBlur = null;
+            this._onFocus = null;
         };
         ArcRotateCameraKeyboardMoveInput.prototype.checkInputs = function () {
             if (this._onKeyDown) {
@@ -34874,6 +34885,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ArcRotateCamera.prototype, "bouncingBehavior", {
+            get: function () {
+                return this._bouncingBehavior;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ArcRotateCamera.prototype, "useBouncingBehavior", {
             get: function () {
                 return this._bouncingBehavior != null;
@@ -34894,6 +34912,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ArcRotateCamera.prototype, "framingBehavior", {
+            get: function () {
+                return this._framingBehavior;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ArcRotateCamera.prototype, "useFramingBehavior", {
             get: function () {
                 return this._framingBehavior != null;
@@ -34914,6 +34939,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ArcRotateCamera.prototype, "autoRotationBehavior", {
+            get: function () {
+                return this._autoRotationBehavior;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ArcRotateCamera.prototype, "useAutoRotationBehavior", {
             get: function () {
                 return this._autoRotationBehavior != null;
@@ -70189,7 +70221,7 @@ var BABYLON;
          *  Applies any current user interaction to the camera. Takes into account maximum alpha rotation.
          */
         FramingBehavior.prototype._applyUserInteraction = function () {
-            if (this._userIsMoving()) {
+            if (this.isUserIsMoving) {
                 this._lastInteractionTime = BABYLON.Tools.Now;
                 this.stopAllAnimations();
                 this._clearAnimationLocks();
@@ -70208,15 +70240,21 @@ var BABYLON;
                 this._animatables.shift();
             }
         };
-        // Tools
-        FramingBehavior.prototype._userIsMoving = function () {
-            return this._attachedCamera.inertialAlphaOffset !== 0 ||
-                this._attachedCamera.inertialBetaOffset !== 0 ||
-                this._attachedCamera.inertialRadiusOffset !== 0 ||
-                this._attachedCamera.inertialPanningX !== 0 ||
-                this._attachedCamera.inertialPanningY !== 0 ||
-                this._isPointerDown;
-        };
+        Object.defineProperty(FramingBehavior.prototype, "isUserIsMoving", {
+            /**
+             * Gets a value indicating if the user is moving the camera
+             */
+            get: function () {
+                return this._attachedCamera.inertialAlphaOffset !== 0 ||
+                    this._attachedCamera.inertialBetaOffset !== 0 ||
+                    this._attachedCamera.inertialRadiusOffset !== 0 ||
+                    this._attachedCamera.inertialPanningX !== 0 ||
+                    this._attachedCamera.inertialPanningY !== 0 ||
+                    this._isPointerDown;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
          * The easing function used by animations
          */
@@ -70403,6 +70441,7 @@ var BABYLON;
             this._isPointerDown = false;
             this._lastFrameTime = null;
             this._lastInteractionTime = -Infinity;
+            this._cameraRotationSpeed = 0;
             this._lastFrameRadius = 0;
         }
         Object.defineProperty(AutoRotationBehavior.prototype, "name", {
@@ -70476,6 +70515,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(AutoRotationBehavior.prototype, "rotationInProgress", {
+            /**
+             * Gets a value indicating if the camera is currently rotating because of this behavior
+             */
+            get: function () {
+                return Math.abs(this._cameraRotationSpeed) > 0;
+            },
+            enumerable: true,
+            configurable: true
+        });
         AutoRotationBehavior.prototype.attach = function (camera) {
             var _this = this;
             this._attachedCamera = camera;
@@ -70500,9 +70549,9 @@ var BABYLON;
                 _this._applyUserInteraction();
                 var timeToRotation = now - _this._lastInteractionTime - _this._idleRotationWaitTime;
                 var scale = Math.max(Math.min(timeToRotation / (_this._idleRotationSpinupTime), 1), 0);
-                var cameraRotationSpeed = _this._idleRotationSpeed * scale;
+                _this._cameraRotationSpeed = _this._idleRotationSpeed * scale;
                 // Step camera rotation by rotation speed
-                _this._attachedCamera.alpha -= cameraRotationSpeed * (dt / 1000);
+                _this._attachedCamera.alpha -= _this._cameraRotationSpeed * (dt / 1000);
             });
         };
         AutoRotationBehavior.prototype.detach = function (camera) {

Різницю між файлами не показано, бо вона завелика
+ 6264 - 6251
dist/preview release/babylon.module.d.ts


Різницю між файлами не показано, бо вона завелика
+ 41 - 41
dist/preview release/babylon.worker.js


Різницю між файлами не показано, бо вона завелика
+ 5373 - 5360
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Різницю між файлами не показано, бо вона завелика
+ 17 - 17
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


+ 66 - 17
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js

@@ -31406,16 +31406,25 @@ var BABYLON;
             this._onLostFocus = function () {
                 _this._keys = [];
             };
-            element.addEventListener("keydown", this._onKeyDown, false);
-            element.addEventListener("keyup", this._onKeyUp, false);
+            this._onFocus = function () {
+                element.addEventListener("keydown", _this._onKeyDown, false);
+                element.addEventListener("keyup", _this._onKeyUp, false);
+            };
+            this._onBlur = function () {
+                element.removeEventListener("keydown", _this._onKeyDown);
+                element.removeEventListener("keyup", _this._onKeyUp);
+            };
+            element.addEventListener("focus", this._onFocus);
+            element.addEventListener("blur", this._onBlur);
             BABYLON.Tools.RegisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
             ]);
         };
         ArcRotateCameraKeyboardMoveInput.prototype.detachControl = function (element) {
-            if (element) {
-                element.removeEventListener("keydown", this._onKeyDown);
-                element.removeEventListener("keyup", this._onKeyUp);
+            if (element && this._onBlur) {
+                this._onBlur();
+                element.removeEventListener("focus", this._onFocus);
+                element.removeEventListener("blur", this._onBlur);
             }
             BABYLON.Tools.UnregisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
@@ -31424,6 +31433,8 @@ var BABYLON;
             this._onKeyDown = null;
             this._onKeyUp = null;
             this._onLostFocus = null;
+            this._onBlur = null;
+            this._onFocus = null;
         };
         ArcRotateCameraKeyboardMoveInput.prototype.checkInputs = function () {
             if (this._onKeyDown) {
@@ -31966,6 +31977,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ArcRotateCamera.prototype, "bouncingBehavior", {
+            get: function () {
+                return this._bouncingBehavior;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ArcRotateCamera.prototype, "useBouncingBehavior", {
             get: function () {
                 return this._bouncingBehavior != null;
@@ -31986,6 +32004,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ArcRotateCamera.prototype, "framingBehavior", {
+            get: function () {
+                return this._framingBehavior;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ArcRotateCamera.prototype, "useFramingBehavior", {
             get: function () {
                 return this._framingBehavior != null;
@@ -32006,6 +32031,13 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(ArcRotateCamera.prototype, "autoRotationBehavior", {
+            get: function () {
+                return this._autoRotationBehavior;
+            },
+            enumerable: true,
+            configurable: true
+        });
         Object.defineProperty(ArcRotateCamera.prototype, "useAutoRotationBehavior", {
             get: function () {
                 return this._autoRotationBehavior != null;
@@ -50162,7 +50194,7 @@ var BABYLON;
          *  Applies any current user interaction to the camera. Takes into account maximum alpha rotation.
          */
         FramingBehavior.prototype._applyUserInteraction = function () {
-            if (this._userIsMoving()) {
+            if (this.isUserIsMoving) {
                 this._lastInteractionTime = BABYLON.Tools.Now;
                 this.stopAllAnimations();
                 this._clearAnimationLocks();
@@ -50181,15 +50213,21 @@ var BABYLON;
                 this._animatables.shift();
             }
         };
-        // Tools
-        FramingBehavior.prototype._userIsMoving = function () {
-            return this._attachedCamera.inertialAlphaOffset !== 0 ||
-                this._attachedCamera.inertialBetaOffset !== 0 ||
-                this._attachedCamera.inertialRadiusOffset !== 0 ||
-                this._attachedCamera.inertialPanningX !== 0 ||
-                this._attachedCamera.inertialPanningY !== 0 ||
-                this._isPointerDown;
-        };
+        Object.defineProperty(FramingBehavior.prototype, "isUserIsMoving", {
+            /**
+             * Gets a value indicating if the user is moving the camera
+             */
+            get: function () {
+                return this._attachedCamera.inertialAlphaOffset !== 0 ||
+                    this._attachedCamera.inertialBetaOffset !== 0 ||
+                    this._attachedCamera.inertialRadiusOffset !== 0 ||
+                    this._attachedCamera.inertialPanningX !== 0 ||
+                    this._attachedCamera.inertialPanningY !== 0 ||
+                    this._isPointerDown;
+            },
+            enumerable: true,
+            configurable: true
+        });
         /**
          * The easing function used by animations
          */
@@ -50376,6 +50414,7 @@ var BABYLON;
             this._isPointerDown = false;
             this._lastFrameTime = null;
             this._lastInteractionTime = -Infinity;
+            this._cameraRotationSpeed = 0;
             this._lastFrameRadius = 0;
         }
         Object.defineProperty(AutoRotationBehavior.prototype, "name", {
@@ -50449,6 +50488,16 @@ var BABYLON;
             enumerable: true,
             configurable: true
         });
+        Object.defineProperty(AutoRotationBehavior.prototype, "rotationInProgress", {
+            /**
+             * Gets a value indicating if the camera is currently rotating because of this behavior
+             */
+            get: function () {
+                return Math.abs(this._cameraRotationSpeed) > 0;
+            },
+            enumerable: true,
+            configurable: true
+        });
         AutoRotationBehavior.prototype.attach = function (camera) {
             var _this = this;
             this._attachedCamera = camera;
@@ -50473,9 +50522,9 @@ var BABYLON;
                 _this._applyUserInteraction();
                 var timeToRotation = now - _this._lastInteractionTime - _this._idleRotationWaitTime;
                 var scale = Math.max(Math.min(timeToRotation / (_this._idleRotationSpinupTime), 1), 0);
-                var cameraRotationSpeed = _this._idleRotationSpeed * scale;
+                _this._cameraRotationSpeed = _this._idleRotationSpeed * scale;
                 // Step camera rotation by rotation speed
-                _this._attachedCamera.alpha -= cameraRotationSpeed * (dt / 1000);
+                _this._attachedCamera.alpha -= _this._cameraRotationSpeed * (dt / 1000);
             });
         };
         AutoRotationBehavior.prototype.detach = function (camera) {

Різницю між файлами не показано, бо вона завелика
+ 5373 - 5360
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


+ 1 - 1
dist/preview release/gui/babylon.gui.js

@@ -199,7 +199,7 @@ var BABYLON;
                             continue;
                         }
                         var mesh = control._linkedMesh;
-                        if (mesh.isDisposed()) {
+                        if (!mesh || mesh.isDisposed()) {
                             BABYLON.Tools.SetImmediate(function () {
                                 control.linkWithMesh(null);
                             });

Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/gui/babylon.gui.min.js


Різницю між файлами не показано, бо вона завелика
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


+ 1 - 1
gui/src/advancedDynamicTexture.ts

@@ -209,7 +209,7 @@ module BABYLON.GUI {
 
                     var mesh = control._linkedMesh;
 
-                    if (mesh.isDisposed()) {
+                    if (!mesh || mesh.isDisposed()) {
                         Tools.SetImmediate(()=>{
                             control.linkWithMesh(null);
                         });

+ 11 - 3
src/Behaviors/Cameras/babylon.autoRotationBehavior.ts

@@ -64,6 +64,13 @@ module BABYLON {
 		public get idleRotationSpinupTime() {
 			return this._idleRotationSpinupTime;
 		}
+
+		/**
+		 * Gets a value indicating if the camera is currently rotating because of this behavior
+		 */
+		public get rotationInProgress(): boolean {
+			return Math.abs(this._cameraRotationSpeed) > 0;
+		}
         
         // Default behavior functions
         private _onPrePointerObservableObserver: Observer<PointerInfoPre>;
@@ -71,7 +78,8 @@ module BABYLON {
         private _attachedCamera: ArcRotateCamera;
         private _isPointerDown = false;
         private _lastFrameTime: number = null;
-        private _lastInteractionTime = -Infinity;
+		private _lastInteractionTime = -Infinity;
+		private _cameraRotationSpeed: number = 0;
 
         public attach(camera: ArcRotateCamera): void {
             this._attachedCamera = camera;
@@ -101,10 +109,10 @@ module BABYLON {
     
                 let timeToRotation = now - this._lastInteractionTime - this._idleRotationWaitTime;
 				let scale = Math.max(Math.min(timeToRotation / (this._idleRotationSpinupTime), 1), 0);
-                let cameraRotationSpeed = this._idleRotationSpeed * scale;
+                this._cameraRotationSpeed = this._idleRotationSpeed * scale;
     
                 // Step camera rotation by rotation speed
-                this._attachedCamera.alpha -= cameraRotationSpeed * (dt / 1000);
+                this._attachedCamera.alpha -= this._cameraRotationSpeed * (dt / 1000);
             });
         }
              

+ 5 - 3
src/Behaviors/Cameras/babylon.framingBehavior.ts

@@ -349,7 +349,7 @@ module BABYLON {
 		 *  Applies any current user interaction to the camera. Takes into account maximum alpha rotation.
 		 */          
         private _applyUserInteraction(): void {
-			if (this._userIsMoving()) {
+			if (this.isUserIsMoving) {
                 this._lastInteractionTime = Tools.Now;
 				this.stopAllAnimations();				
 				this._clearAnimationLocks();
@@ -370,8 +370,10 @@ module BABYLON {
 			}
 		}        
 
-        // Tools
-        private _userIsMoving(): boolean {
+        /**
+		 * Gets a value indicating if the user is moving the camera
+		 */
+        public get isUserIsMoving(): boolean {
 			return this._attachedCamera.inertialAlphaOffset !== 0 ||
 				this._attachedCamera.inertialBetaOffset !== 0 ||
 				this._attachedCamera.inertialRadiusOffset !== 0 ||

+ 20 - 5
src/Cameras/Inputs/babylon.arcRotateCameraKeyboardMoveInput.ts

@@ -5,6 +5,8 @@ module BABYLON {
         private _onKeyDown: (e: KeyboardEvent) => any;
         private _onKeyUp: (e: KeyboardEvent) => any;
         private _onLostFocus: (e: FocusEvent) => any;
+        private _onFocus: () => void;
+        private _onBlur: () => void;
         
         @serialize()
         public keysUp = [38];
@@ -65,8 +67,18 @@ module BABYLON {
                 this._keys = [];
             };
 
-            element.addEventListener("keydown", this._onKeyDown, false);
-            element.addEventListener("keyup", this._onKeyUp, false);
+            this._onFocus = () => {
+                element.addEventListener("keydown", this._onKeyDown, false);
+                element.addEventListener("keyup", this._onKeyUp, false);   
+            }
+
+            this._onBlur = () => {
+                element.removeEventListener("keydown", this._onKeyDown);
+                element.removeEventListener("keyup", this._onKeyUp);
+            }
+
+            element.addEventListener("focus", this._onFocus);
+            element.addEventListener("blur", this._onBlur);
 
             Tools.RegisterTopRootEvents([
                 { name: "blur", handler: this._onLostFocus }
@@ -74,9 +86,10 @@ module BABYLON {
         }
 
         public detachControl(element: HTMLElement) {
-            if (element) {
-                element.removeEventListener("keydown", this._onKeyDown);
-                element.removeEventListener("keyup", this._onKeyUp);
+            if (element && this._onBlur) {
+                this._onBlur();
+                element.removeEventListener("focus", this._onFocus);
+                element.removeEventListener("blur", this._onBlur);
             }
 
             Tools.UnregisterTopRootEvents([
@@ -87,6 +100,8 @@ module BABYLON {
             this._onKeyDown = null;
             this._onKeyUp = null;
             this._onLostFocus = null;
+            this._onBlur = null;
+            this._onFocus = null;
         }
 
         public checkInputs() {

+ 15 - 0
src/Cameras/babylon.arcRotateCamera.ts

@@ -196,6 +196,11 @@ module BABYLON {
 
         // Behaviors
         private _bouncingBehavior: BouncingBehavior;
+
+        public get bouncingBehavior(): BouncingBehavior {
+            return this._bouncingBehavior;
+        }
+
         public get useBouncingBehavior(): boolean {
             return this._bouncingBehavior != null;
         }
@@ -215,6 +220,11 @@ module BABYLON {
         }
 
         private _framingBehavior: FramingBehavior;
+
+        public get framingBehavior(): FramingBehavior {
+            return this._framingBehavior;
+        }        
+
         public get useFramingBehavior(): boolean {
             return this._framingBehavior != null;
         }
@@ -234,6 +244,11 @@ module BABYLON {
         }        
 
         private _autoRotationBehavior: AutoRotationBehavior;
+
+        public get autoRotationBehavior(): AutoRotationBehavior {
+            return this._autoRotationBehavior;
+        }   
+
         public get useAutoRotationBehavior(): boolean {
             return this._autoRotationBehavior != null;
         }