Просмотр исходного кода

Fixes https://github.com/BabylonJS/Website/issues/128
Fixes https://github.com/BabylonJS/Website/issues/127

David Catuhe 8 лет назад
Родитель
Сommit
d95238cf66
26 измененных файлов с 13230 добавлено и 13189 удалено
  1. 1278 1278
      dist/preview release/babylon.d.ts
  2. 42 42
      dist/preview release/babylon.js
  3. 17 3
      dist/preview release/babylon.max.js
  4. 1278 1278
      dist/preview release/babylon.module.d.ts
  5. 43 43
      dist/preview release/babylon.worker.js
  6. 5102 5102
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts
  7. 45 45
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js
  8. 17 3
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.max.js
  9. 5102 5102
      dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts
  10. 3 3
      dist/preview release/gui/babylon.gui.min.js
  11. 263 263
      dist/preview release/inspector/babylon.inspector.bundle.js
  12. 3 3
      dist/preview release/inspector/babylon.inspector.min.js
  13. 2 2
      dist/preview release/loaders/babylon.glTF1FileLoader.min.js
  14. 1 1
      dist/preview release/loaders/babylon.glTF2FileLoader.min.js
  15. 2 2
      dist/preview release/loaders/babylon.glTFFileLoader.min.js
  16. 1 1
      dist/preview release/loaders/babylon.objFileLoader.min.js
  17. 1 1
      dist/preview release/materialsLibrary/babylon.customMaterial.min.js
  18. 1 1
      dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js
  19. 1 1
      dist/preview release/materialsLibrary/babylon.waterMaterial.min.js
  20. 1 1
      dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js
  21. 1 1
      dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js
  22. 7 10
      sandbox/index.js
  23. 16 1
      src/Behaviors/Cameras/babylon.framingBehavior.ts
  24. 1 1
      src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts
  25. 1 1
      src/Cameras/babylon.arcRotateCamera.ts
  26. 1 0
      src/Loading/babylon.loadingScreen.ts

Разница между файлами не показана из-за своего большого размера
+ 1278 - 1278
dist/preview release/babylon.d.ts


Разница между файлами не показана из-за своего большого размера
+ 42 - 42
dist/preview release/babylon.js


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

@@ -35463,7 +35463,7 @@ var BABYLON;
                         //Nothing to do with the error. Execution will continue.
                     }
                     // Manage panning with pan button click
-                    _this._isPanClick = evt.button === _this.camera._panningMouseButton;
+                    _this._isPanClick = evt.button === _this.camera._panningMouseButton && evt.pointerType !== "mouse";
                     // manage pointers
                     cacheSoloPointer = { x: evt.clientX, y: evt.clientY, pointerId: evt.pointerId, type: evt.pointerType };
                     if (pointA === undefined) {
@@ -36034,7 +36034,7 @@ var BABYLON;
             this.alpha = this._storedAlpha;
             this.beta = this._storedBeta;
             this.radius = this._storedRadius;
-            this.setTarget(this._storedTarget);
+            this.setTarget(this._storedTarget.clone());
             this.inertialAlphaOffset = 0;
             this.inertialBetaOffset = 0;
             this.inertialRadiusOffset = 0;
@@ -48662,6 +48662,7 @@ var BABYLON;
             this._loadingDiv.id = "babylonjsLoadingDiv";
             this._loadingDiv.style.opacity = "0";
             this._loadingDiv.style.transition = "opacity 1.5s ease";
+            this._loadingDiv.style.pointerEvents = "none";
             // Loading text
             this._loadingTextDiv = document.createElement("div");
             this._loadingTextDiv.style.position = "absolute";
@@ -72152,6 +72153,7 @@ var BABYLON;
          * @param onAnimationEnd Callback triggered at the end of the framing animation
          */
         FramingBehavior.prototype.zoomOnBoundingInfo = function (minimumWorld, maximumWorld, focusOnOriginXZ, onAnimationEnd) {
+            var _this = this;
             if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }
             if (onAnimationEnd === void 0) { onAnimationEnd = null; }
             var zoomTarget;
@@ -72187,11 +72189,20 @@ var BABYLON;
                     this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;
                 }
             }
+            // Set sensibilities
+            var extend = maximumWorld.subtract(minimumWorld).length();
+            this._attachedCamera.panningSensibility = 5000 / extend;
+            this._attachedCamera.wheelPrecision = 100 / radius;
             // transition to new radius
             if (!this._radiusTransition) {
                 this._radiusTransition = BABYLON.Animation.CreateAnimation("radius", BABYLON.Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);
             }
-            this._animatables.push(BABYLON.Animation.TransitionTo("radius", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, onAnimationEnd));
+            this._animatables.push(BABYLON.Animation.TransitionTo("radius", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, function () {
+                if (onAnimationEnd) {
+                    onAnimationEnd();
+                }
+                _this._attachedCamera.storeState();
+            }));
         };
         /**
          * Calculates the lowest radius for the camera based on the bounding box of the mesh.
@@ -72229,6 +72240,9 @@ var BABYLON;
          */
         FramingBehavior.prototype._maintainCameraAboveGround = function () {
             var _this = this;
+            if (this._elevationReturnTime < 0) {
+                return;
+            }
             var timeSinceInteraction = BABYLON.Tools.Now - this._lastInteractionTime;
             var defaultBeta = Math.PI * 0.5 - this._defaultElevation;
             var limitBeta = Math.PI * 0.5;

Разница между файлами не показана из-за своего большого размера
+ 1278 - 1278
dist/preview release/babylon.module.d.ts


Разница между файлами не показана из-за своего большого размера
+ 43 - 43
dist/preview release/babylon.worker.js


Разница между файлами не показана из-за своего большого размера
+ 5102 - 5102
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.d.ts


Разница между файлами не показана из-за своего большого размера
+ 45 - 45
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.js


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

@@ -35463,7 +35463,7 @@ var BABYLON;
                         //Nothing to do with the error. Execution will continue.
                     }
                     // Manage panning with pan button click
-                    _this._isPanClick = evt.button === _this.camera._panningMouseButton;
+                    _this._isPanClick = evt.button === _this.camera._panningMouseButton && evt.pointerType !== "mouse";
                     // manage pointers
                     cacheSoloPointer = { x: evt.clientX, y: evt.clientY, pointerId: evt.pointerId, type: evt.pointerType };
                     if (pointA === undefined) {
@@ -36034,7 +36034,7 @@ var BABYLON;
             this.alpha = this._storedAlpha;
             this.beta = this._storedBeta;
             this.radius = this._storedRadius;
-            this.setTarget(this._storedTarget);
+            this.setTarget(this._storedTarget.clone());
             this.inertialAlphaOffset = 0;
             this.inertialBetaOffset = 0;
             this.inertialRadiusOffset = 0;
@@ -48662,6 +48662,7 @@ var BABYLON;
             this._loadingDiv.id = "babylonjsLoadingDiv";
             this._loadingDiv.style.opacity = "0";
             this._loadingDiv.style.transition = "opacity 1.5s ease";
+            this._loadingDiv.style.pointerEvents = "none";
             // Loading text
             this._loadingTextDiv = document.createElement("div");
             this._loadingTextDiv.style.position = "absolute";
@@ -72152,6 +72153,7 @@ var BABYLON;
          * @param onAnimationEnd Callback triggered at the end of the framing animation
          */
         FramingBehavior.prototype.zoomOnBoundingInfo = function (minimumWorld, maximumWorld, focusOnOriginXZ, onAnimationEnd) {
+            var _this = this;
             if (focusOnOriginXZ === void 0) { focusOnOriginXZ = false; }
             if (onAnimationEnd === void 0) { onAnimationEnd = null; }
             var zoomTarget;
@@ -72187,11 +72189,20 @@ var BABYLON;
                     this._attachedCamera.lowerRadiusLimit = this._attachedCamera.minZ;
                 }
             }
+            // Set sensibilities
+            var extend = maximumWorld.subtract(minimumWorld).length();
+            this._attachedCamera.panningSensibility = 5000 / extend;
+            this._attachedCamera.wheelPrecision = 100 / radius;
             // transition to new radius
             if (!this._radiusTransition) {
                 this._radiusTransition = BABYLON.Animation.CreateAnimation("radius", BABYLON.Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);
             }
-            this._animatables.push(BABYLON.Animation.TransitionTo("radius", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, onAnimationEnd));
+            this._animatables.push(BABYLON.Animation.TransitionTo("radius", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, function () {
+                if (onAnimationEnd) {
+                    onAnimationEnd();
+                }
+                _this._attachedCamera.storeState();
+            }));
         };
         /**
          * Calculates the lowest radius for the camera based on the bounding box of the mesh.
@@ -72229,6 +72240,9 @@ var BABYLON;
          */
         FramingBehavior.prototype._maintainCameraAboveGround = function () {
             var _this = this;
+            if (this._elevationReturnTime < 0) {
+                return;
+            }
             var timeSinceInteraction = BABYLON.Tools.Now - this._lastInteractionTime;
             var defaultBeta = Math.PI * 0.5 - this._defaultElevation;
             var limitBeta = Math.PI * 0.5;

Разница между файлами не показана из-за своего большого размера
+ 5102 - 5102
dist/preview release/customConfigurations/minimalGLTFViewer/babylon.module.d.ts


Разница между файлами не показана из-за своего большого размера
+ 3 - 3
dist/preview release/gui/babylon.gui.min.js


Разница между файлами не показана из-за своего большого размера
+ 263 - 263
dist/preview release/inspector/babylon.inspector.bundle.js


Разница между файлами не показана из-за своего большого размера
+ 3 - 3
dist/preview release/inspector/babylon.inspector.min.js


Разница между файлами не показана из-за своего большого размера
+ 2 - 2
dist/preview release/loaders/babylon.glTF1FileLoader.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.min.js


Разница между файлами не показана из-за своего большого размера
+ 2 - 2
dist/preview release/loaders/babylon.glTFFileLoader.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/loaders/babylon.objFileLoader.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/materialsLibrary/babylon.customMaterial.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/materialsLibrary/babylon.shadowOnlyMaterial.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/materialsLibrary/babylon.waterMaterial.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.asciiArtPostProcess.min.js


Разница между файлами не показана из-за своего большого размера
+ 1 - 1
dist/preview release/postProcessesLibrary/babylon.digitalRainPostProcess.min.js


+ 7 - 10
sandbox/index.js

@@ -18,6 +18,10 @@
     var enableDebugLayer = false;
     var currentPluginName;
 
+    canvas.addEventListener("contextmenu", function(evt) {
+        evt.preventDefault();
+    }, false);
+
     currentHelpCounter = localStorage.getItem("helpcounter");
 
     BABYLON.Engine.ShadersRepository = "/src/Shaders/";
@@ -73,21 +77,14 @@
 
             var framingBehavior = currentScene.activeCamera.getBehaviorByName("Framing");
             framingBehavior.framingTime = 0;
-            framingBehavior.elevationReturnWaitTime = -1;
+            framingBehavior.elevationReturnTime = -1;
 
             var bouncingBehavior = currentScene.activeCamera.getBehaviorByName("Bouncing");
             bouncingBehavior.autoTransitionRange = true;        
 
             if (currentScene.meshes.length) {
-                // Let's zoom on the first object with geometry
-                for (var index = 0; index < currentScene.meshes.length; index++) {
-                    var mesh = currentScene.meshes[index];
-
-                    if (mesh.getTotalVertices()) {
-                        currentScene.activeCamera.setTarget(mesh);
-                        break;
-                    }
-                }
+                var worldExtends = currentScene.getWorldExtends();
+                framingBehavior.zoomOnBoundingInfo(worldExtends.min, worldExtends.max);
             }
         }
 

+ 16 - 1
src/Behaviors/Cameras/babylon.framingBehavior.ts

@@ -261,13 +261,24 @@ module BABYLON {
 				}
 			}
 
+			// Set sensibilities
+			let extend = maximumWorld.subtract(minimumWorld).length();
+			this._attachedCamera.panningSensibility = 5000 / extend;
+			this._attachedCamera.wheelPrecision = 100 / radius;
+
 			// transition to new radius
 			if (!this._radiusTransition) {
 				this._radiusTransition = Animation.CreateAnimation("radius", Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);
 			}
 
 			this._animatables.push(Animation.TransitionTo("radius", radius, this._attachedCamera, this._attachedCamera.getScene(), 
-				60, this._radiusTransition, this._framingTime, onAnimationEnd));
+				60, this._radiusTransition, this._framingTime, () => {
+					if (onAnimationEnd) {
+						onAnimationEnd();
+					}
+
+					this._attachedCamera.storeState();
+				}));
 		}
 		
 		/**
@@ -311,6 +322,10 @@ module BABYLON {
 		 * is automatically returned to its default position (expected to be above ground plane). 
 		 */
 		private _maintainCameraAboveGround(): void {
+			if (this._elevationReturnTime < 0) {
+				return;
+			}
+
 			let timeSinceInteraction = Tools.Now - this._lastInteractionTime;
 			let defaultBeta = Math.PI * 0.5 - this._defaultElevation;
 			let limitBeta = Math.PI * 0.5;

+ 1 - 1
src/Cameras/Inputs/babylon.arcRotateCameraPointersInput.ts

@@ -61,7 +61,7 @@ module BABYLON {
                     }
 
                     // Manage panning with pan button click
-                    this._isPanClick = evt.button === this.camera._panningMouseButton;
+                    this._isPanClick = evt.button === this.camera._panningMouseButton && evt.pointerType !== "mouse";
 
                     // manage pointers
                     cacheSoloPointer = { x: evt.clientX, y: evt.clientY, pointerId: evt.pointerId, type: evt.pointerType };

+ 1 - 1
src/Cameras/babylon.arcRotateCamera.ts

@@ -385,7 +385,7 @@ module BABYLON {
             this.alpha = this._storedAlpha;
             this.beta = this._storedBeta;
             this.radius = this._storedRadius;
-            this.setTarget(this._storedTarget);
+            this.setTarget(this._storedTarget.clone());
 
             this.inertialAlphaOffset = 0;
             this.inertialBetaOffset = 0;

+ 1 - 0
src/Loading/babylon.loadingScreen.ts

@@ -29,6 +29,7 @@ module BABYLON {
             this._loadingDiv.id = "babylonjsLoadingDiv";
             this._loadingDiv.style.opacity = "0";
             this._loadingDiv.style.transition = "opacity 1.5s ease";
+            this._loadingDiv.style.pointerEvents = "none";
 
             // Loading text
             this._loadingTextDiv = document.createElement("div");