From 8ac4ac81bcd0f5ec31a6a9b7623f608e0c8faefc Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 31 Mar 2026 17:42:23 +0200 Subject: [PATCH] Add effect to update model instance draft values in App.tsx --- src/app/App.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/app/App.tsx b/src/app/App.tsx index 3bbe7aa7..4a2912d1 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -732,6 +732,19 @@ export function App({ store, initialStatusMessage }: AppProps) { } }, [selectedEntity]); + useEffect(() => { + if (selectedModelInstance === null) { + setModelPositionDraft(createVec3Draft(DEFAULT_MODEL_INSTANCE_POSITION)); + setModelRotationDraft(createVec3Draft(DEFAULT_MODEL_INSTANCE_ROTATION_DEGREES)); + setModelScaleDraft(createVec3Draft(DEFAULT_MODEL_INSTANCE_SCALE)); + return; + } + + setModelPositionDraft(createVec3Draft(selectedModelInstance.position)); + setModelRotationDraft(createVec3Draft(selectedModelInstance.rotationDegrees)); + setModelScaleDraft(createVec3Draft(selectedModelInstance.scale)); + }, [selectedModelInstance]); + useEffect(() => { setAmbientLightIntensityDraft(String(editorState.document.world.ambientLight.intensity)); }, [editorState.document.world.ambientLight.intensity]);