David Catuhe 5 سال پیش
والد
کامیت
9020aaf491
2فایلهای تغییر یافته به همراه14 افزوده شده و 17 حذف شده
  1. 14 11
      nodeEditor/src/components/preview/previewManager.ts
  2. 0 6
      src/Behaviors/Cameras/framingBehavior.ts

+ 14 - 11
nodeEditor/src/components/preview/previewManager.ts

@@ -191,18 +191,21 @@ export class PreviewManager {
         this._camera.useFramingBehavior = true;
 
         var framingBehavior = this._camera.getBehaviorByName("Framing") as FramingBehavior;
-        framingBehavior.framingTime = 0;
-        framingBehavior.elevationReturnTime = -1;
-
-        if (this._scene.meshes.length) {
-            var worldExtends = this._scene.getWorldExtends();
-            this._camera.lowerRadiusLimit = null;
-            this._camera.upperRadiusLimit = null;
-            framingBehavior.zoomOnBoundingInfo(worldExtends.min, worldExtends.max);
-        }
 
-        this._camera.pinchPrecision = 200 / this._camera.radius;
-        this._camera.upperRadiusLimit = 5 * this._camera.radius;
+        setTimeout(() => { // Let the behavior activate first
+            framingBehavior.framingTime = 0;
+            framingBehavior.elevationReturnTime = -1;
+    
+            if (this._scene.meshes.length) {
+                var worldExtends = this._scene.getWorldExtends();
+                this._camera.lowerRadiusLimit = null;
+                this._camera.upperRadiusLimit = null;
+                framingBehavior.zoomOnBoundingInfo(worldExtends.min, worldExtends.max);
+            }
+    
+            this._camera.pinchPrecision = 200 / this._camera.radius;
+            this._camera.upperRadiusLimit = 5 * this._camera.radius;    
+        });
 
         this._camera.wheelDeltaPercentage = 0.01;
         this._camera.pinchDeltaPercentage = 0.01;

+ 0 - 6
src/Behaviors/Cameras/framingBehavior.ts

@@ -251,8 +251,6 @@ export class FramingBehavior implements Behavior<ArcRotateCamera> {
     /**
      * Targets the given mesh and updates zoom level accordingly.
      * @param mesh  The mesh to target.
-     * @param radius Optional. If a cached radius position already exists, overrides default.
-     * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top
      * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh
      * @param onAnimationEnd Callback triggered at the end of the framing animation
      */
@@ -266,8 +264,6 @@ export class FramingBehavior implements Behavior<ArcRotateCamera> {
     /**
      * Targets the given mesh with its children and updates zoom level accordingly.
      * @param mesh  The mesh to target.
-     * @param radius Optional. If a cached radius position already exists, overrides default.
-     * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top
      * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh
      * @param onAnimationEnd Callback triggered at the end of the framing animation
      */
@@ -281,8 +277,6 @@ export class FramingBehavior implements Behavior<ArcRotateCamera> {
     /**
      * Targets the given meshes with their children and updates zoom level accordingly.
      * @param meshes  The mesh to target.
-     * @param radius Optional. If a cached radius position already exists, overrides default.
-     * @param framingPositionY Position on mesh to center camera focus where 0 corresponds bottom of its bounding box and 1, the top
      * @param focusOnOriginXZ Determines if the camera should focus on 0 in the X and Z axis instead of the mesh
      * @param onAnimationEnd Callback triggered at the end of the framing animation
      */