From 4a926d41e42efb3158196e145c80a0d8c6825e45 Mon Sep 17 00:00:00 2001 From: keiya sasaki <34934510+keiya01@users.noreply.github.com> Date: Tue, 11 Jun 2024 12:08:09 +0900 Subject: [PATCH] chore(web): camera move in published page (#1014) --- web/src/beta/features/PublishedVisualizer/hooks.ts | 4 ++++ web/src/beta/features/PublishedVisualizer/index.tsx | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/web/src/beta/features/PublishedVisualizer/hooks.ts b/web/src/beta/features/PublishedVisualizer/hooks.ts index 3df6092d75..f743201700 100644 --- a/web/src/beta/features/PublishedVisualizer/hooks.ts +++ b/web/src/beta/features/PublishedVisualizer/hooks.ts @@ -8,6 +8,7 @@ import { isBuiltinWidget, } from "@reearth/beta/features/Visualizer/Crust"; import { Story } from "@reearth/beta/features/Visualizer/StoryPanel"; +import type { Camera } from "@reearth/beta/utils/value"; import { MapRef } from "@reearth/core"; import { config } from "@reearth/services/config"; @@ -27,6 +28,7 @@ export default (alias?: string) => { const [data, setData] = useState(); const [ready, setReady] = useState(false); const [error, setError] = useState(false); + const [currentCamera, setCurrentCamera] = useState(undefined); const sceneProperty = processProperty(data?.property); const pluginProperty = useMemo( @@ -251,6 +253,8 @@ export default (alias?: string) => { error, engineMeta, visualizerRef, + currentCamera, + setCurrentCamera, }; }; diff --git a/web/src/beta/features/PublishedVisualizer/index.tsx b/web/src/beta/features/PublishedVisualizer/index.tsx index 2d1bc433be..c733f6d402 100644 --- a/web/src/beta/features/PublishedVisualizer/index.tsx +++ b/web/src/beta/features/PublishedVisualizer/index.tsx @@ -20,6 +20,8 @@ export default function Published({ alias }: Props) { error, engineMeta, visualizerRef, + currentCamera, + setCurrentCamera, } = useHooks(alias); return error ? ( @@ -40,6 +42,8 @@ export default function Published({ alias }: Props) { sceneProperty={sceneProperty} pluginProperty={pluginProperty} showStoryPanel={!!story} + currentCamera={currentCamera} + onCameraChange={setCurrentCamera} /> ); }