From d49af897ff09058c39398df802c1a638fc5d603b Mon Sep 17 00:00:00 2001 From: brentyi Date: Sat, 4 Jan 2025 03:10:00 -0800 Subject: [PATCH] Rename + show if logging camera --- src/viser/client/src/CameraControls.tsx | 11 +++++++---- src/viser/client/src/ControlPanel/GuiState.tsx | 4 ++-- src/viser/client/src/ControlPanel/ServerControls.tsx | 4 ++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/viser/client/src/CameraControls.tsx b/src/viser/client/src/CameraControls.tsx index d1109587..430c3c81 100644 --- a/src/viser/client/src/CameraControls.tsx +++ b/src/viser/client/src/CameraControls.tsx @@ -10,22 +10,24 @@ import { computeT_threeworld_world } from "./WorldTransformUtils"; import { useThrottledMessageSender } from "./WebsocketFunctions"; import { Grid, PivotControls } from "@react-three/drei"; -function CameraOrientationTool({ +function OrbitOriginTool({ + forceShow, pivotRef, onPivotChange, update, }: { + forceShow: boolean; pivotRef: React.RefObject; onPivotChange: (matrix: THREE.Matrix4) => void; update: () => void; }) { const viewer = useContext(ViewerContext)!; const showCameraControls = viewer.useGui( - (state) => state.showCameraControlsTool, + (state) => state.showOrbitOriginTool, ); React.useEffect(update, [showCameraControls]); - if (!showCameraControls) return null; + if (!showCameraControls && !forceShow) return null; return ( - { updateCameraLookAtAndUpFromPivotControl(matrix); diff --git a/src/viser/client/src/ControlPanel/GuiState.tsx b/src/viser/client/src/ControlPanel/GuiState.tsx index f1371bbc..c6aa3124 100644 --- a/src/viser/client/src/ControlPanel/GuiState.tsx +++ b/src/viser/client/src/ControlPanel/GuiState.tsx @@ -16,7 +16,7 @@ interface GuiState { shareUrl: string | null; websocketConnected: boolean; backgroundAvailable: boolean; - showCameraControlsTool: boolean; + showOrbitOriginTool: boolean; guiUuidSetFromContainerUuid: { [containerUuid: string]: { [uuid: string]: true } | undefined; }; @@ -66,7 +66,7 @@ const cleanGuiState: GuiState = { shareUrl: null, websocketConnected: false, backgroundAvailable: false, - showCameraControlsTool: false, + showOrbitOriginTool: false, guiUuidSetFromContainerUuid: {}, modals: [], guiOrderFromUuid: {}, diff --git a/src/viser/client/src/ControlPanel/ServerControls.tsx b/src/viser/client/src/ControlPanel/ServerControls.tsx index 4a35645d..c7faf975 100644 --- a/src/viser/client/src/ControlPanel/ServerControls.tsx +++ b/src/viser/client/src/ControlPanel/ServerControls.tsx @@ -149,10 +149,10 @@ export default function ServerControls() { > { viewer.useGui.setState({ - showCameraControlsTool: event.currentTarget.checked, + showOrbitOriginTool: event.currentTarget.checked, }); }} size="sm"