Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix zoom to cursor #206

Merged
merged 2 commits into from
Mar 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/CameraControls/CameraControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,13 +218,14 @@ 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.wheel = 16;
cameraRef.current.mouseButtons.left = ThreeCameraControls.ACTION.TRUCK;
cameraRef.current.mouseButtons.middle =
ThreeCameraControls.ACTION.TRUCK;
cameraRef.current.mouseButtons.wheel = ThreeCameraControls.ACTION.DOLLY;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the same as cameraRef.current.mouseButtons.wheel = 8, but I figured this was clearer

could also update the above to

cameraRef.current.mouseButtons.left = ThreeCameraControls.ACTION.TRUCK;
cameraRef.current.mouseButtons.middle = ThreeCameraControls.ACTION.TRUCK;

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh also just found a bug where the camera's not disabled when disabled is true

I have a little fix, lmk if I should push it into here. It's not really related

}
}, [disabled]);

Expand Down
Loading