Explorar el Código

tweak moveCamera

dsehnal hace 2 años
padre
commit
d7acec4f7d
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4 2
      src/mol-canvas3d/controls/trackball.ts

+ 4 - 2
src/mol-canvas3d/controls/trackball.ts

@@ -503,8 +503,10 @@ namespace TrackballControls {
             Vec3.add(camera.position, camera.target, _eye);
             checkDistances();
 
-            if (lastUpdated > 0 && deltaT < 1000) {
-                moveCamera(deltaT);
+            if (lastUpdated > 0) {
+                // clamp the maximum step size at 15 frames to avoid too big jumps
+                // TODO: make this a parameter?
+                moveCamera(Math.min(deltaT, 15 * 1000 / 60));
             }
 
             Vec3.sub(_eye, camera.position, camera.target);