From cf7ba96feeb907f572fa04191cce88d4b3b5e98e Mon Sep 17 00:00:00 2001 From: Brent Yi Date: Sun, 24 Sep 2023 17:16:26 -0700 Subject: [PATCH] Remove unused animation code --- src/viser/client/src/CameraControls.tsx | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/viser/client/src/CameraControls.tsx b/src/viser/client/src/CameraControls.tsx index 503ed7840..23f95d657 100644 --- a/src/viser/client/src/CameraControls.tsx +++ b/src/viser/client/src/CameraControls.tsx @@ -13,7 +13,7 @@ export function SynchronizedCameraControls() { const sendCameraThrottled = makeThrottledMessageSender( viewer.websocketRef, - 20, + 20 ); // Helper for resetting camera poses. @@ -30,12 +30,12 @@ export function SynchronizedCameraControls() { initialCameraRef.current!.lookAt.x, initialCameraRef.current!.lookAt.y, initialCameraRef.current!.lookAt.z, - true, + true ); viewer.cameraRef.current!.up.set( initialCameraRef.current!.camera.up.x, initialCameraRef.current!.camera.up.y, - initialCameraRef.current!.camera.up.z, + initialCameraRef.current!.camera.up.z ); viewer.cameraControlRef.current!.updateCameraUp(); }; @@ -93,9 +93,6 @@ export function SynchronizedCameraControls() { }); }, [camera, sendCameraThrottled]); - //Camera Animation code - const animationId = useRef(null); - // Send camera for new connections. // We add a small delay to give the server time to add a callback. const connected = viewer.useGui((state) => state.websocketConnected); @@ -164,28 +161,28 @@ export function SynchronizedCameraControls() { cameraControls.rotate( -0.05 * THREE.MathUtils.DEG2RAD * event?.deltaTime, 0, - true, + true ); }); rightKey.addEventListener("holding", (event) => { cameraControls.rotate( 0.05 * THREE.MathUtils.DEG2RAD * event?.deltaTime, 0, - true, + true ); }); upKey.addEventListener("holding", (event) => { cameraControls.rotate( 0, -0.05 * THREE.MathUtils.DEG2RAD * event?.deltaTime, - true, + true ); }); downKey.addEventListener("holding", (event) => { cameraControls.rotate( 0, 0.05 * THREE.MathUtils.DEG2RAD * event?.deltaTime, - true, + true ); }); @@ -193,9 +190,7 @@ export function SynchronizedCameraControls() { // because KeyboardKeyHold attaches listeners directly to the // document/window; it's unclear if we can remove these. return () => { - if (animationId.current !== null) { - cancelAnimationFrame(animationId.current); - } + return; }; }, [CameraControls]);