From bfb328a469e6946dfd1b194e15cf7e56906fe21e Mon Sep 17 00:00:00 2001 From: Grant Steffen Date: Thu, 14 Mar 2024 09:56:14 -0700 Subject: [PATCH 1/2] Fix zoom to cursor This switches mouse wheel behavior to dolly instead of zoom This allows the dollyToCursor prop to do its thing --- src/CameraControls/CameraControls.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CameraControls/CameraControls.tsx b/src/CameraControls/CameraControls.tsx index 2104e665..ca7afadc 100644 --- a/src/CameraControls/CameraControls.tsx +++ b/src/CameraControls/CameraControls.tsx @@ -224,7 +224,7 @@ export const CameraControls: FC< } else { cameraRef.current.mouseButtons.left = 2; cameraRef.current.mouseButtons.middle = 2; - cameraRef.current.mouseButtons.wheel = 16; + cameraRef.current.mouseButtons.wheel = ThreeCameraControls.ACTION.DOLLY; } }, [disabled]); From 1363b8d1e3f65d2dd7a8c5d2180e54a5c57c8bde Mon Sep 17 00:00:00 2001 From: Grant Steffen Date: Thu, 14 Mar 2024 10:52:06 -0700 Subject: [PATCH 2/2] Update mouseButtons values --- src/CameraControls/CameraControls.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/CameraControls/CameraControls.tsx b/src/CameraControls/CameraControls.tsx index ca7afadc..429f9ab0 100644 --- a/src/CameraControls/CameraControls.tsx +++ b/src/CameraControls/CameraControls.tsx @@ -218,12 +218,13 @@ export const CameraControls: FC< useEffect(() => { if (disabled) { - cameraRef.current.mouseButtons.left = 0; - cameraRef.current.mouseButtons.middle = 0; - cameraRef.current.mouseButtons.wheel = 0; + cameraRef.current.mouseButtons.left = ThreeCameraControls.ACTION.NONE; + cameraRef.current.mouseButtons.middle = ThreeCameraControls.ACTION.NONE; + cameraRef.current.mouseButtons.wheel = ThreeCameraControls.ACTION.NONE; } else { - cameraRef.current.mouseButtons.left = 2; - cameraRef.current.mouseButtons.middle = 2; + cameraRef.current.mouseButtons.left = ThreeCameraControls.ACTION.TRUCK; + cameraRef.current.mouseButtons.middle = + ThreeCameraControls.ACTION.TRUCK; cameraRef.current.mouseButtons.wheel = ThreeCameraControls.ACTION.DOLLY; } }, [disabled]);