Explorar o código

Fixe the radius change event of arcRotateCamera and add a inertia on this.

Julien %!s(int64=11) %!d(string=hai) anos
pai
achega
97fa4a2770
Modificáronse 1 ficheiros con 8 adicións e 2 borrados
  1. 8 2
      Babylon/Cameras/babylon.arcRotateCamera.js

+ 8 - 2
Babylon/Cameras/babylon.arcRotateCamera.js

@@ -31,6 +31,7 @@ var BABYLON = BABYLON || {};
     // Members
     BABYLON.ArcRotateCamera.prototype.inertialAlphaOffset = 0;
     BABYLON.ArcRotateCamera.prototype.inertialBetaOffset = 0;
+    BABYLON.ArcRotateCamera.prototype.inertialRadiusOffset = 0;
     BABYLON.ArcRotateCamera.prototype.lowerAlphaLimit = null;
     BABYLON.ArcRotateCamera.prototype.upperAlphaLimit = null;
     BABYLON.ArcRotateCamera.prototype.lowerBetaLimit = null;
@@ -162,7 +163,7 @@ var BABYLON = BABYLON || {};
                 }
 
                 if (delta)
-                    that.radius -= delta;
+                    that.inertialRadiusOffset += delta;
 
                 if (event.preventDefault) {
                     if (!noPreventDefault) {
@@ -302,19 +303,24 @@ var BABYLON = BABYLON || {};
         }
         
         // Inertia
-        if (this.inertialAlphaOffset != 0 || this.inertialBetaOffset != 0) {
+        if (this.inertialAlphaOffset != 0 || this.inertialBetaOffset != 0 || this.inertialRadiusOffset != 0) {
 
             this.alpha += this.inertialAlphaOffset;
             this.beta += this.inertialBetaOffset;
+            this.radius -= this.inertialRadiusOffset;
 
             this.inertialAlphaOffset *= this.inertia;
             this.inertialBetaOffset *= this.inertia;
+            this.inertialRadiusOffset *= this.inertia;
 
             if (Math.abs(this.inertialAlphaOffset) < BABYLON.Engine.epsilon)
                 this.inertialAlphaOffset = 0;
 
             if (Math.abs(this.inertialBetaOffset) < BABYLON.Engine.epsilon)
                 this.inertialBetaOffset = 0;
+
+            if (Math.abs(this.inertialRadiusOffset) < BABYLON.Engine.epsilon)
+                this.inertialRadiusOffset = 0;
         }
         
         // Limits