From 73dfac795ab8c6931c5c4cf301b85bab5a126aab Mon Sep 17 00:00:00 2001 From: wass08 Date: Mon, 2 Feb 2026 11:39:38 +0900 Subject: [PATCH] fix placement --- .../tools/item/use-placement-coordinator.tsx | 4 +++- packages/core/src/store/actions/node-actions.ts | 12 +++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/apps/editor/components/tools/item/use-placement-coordinator.tsx b/apps/editor/components/tools/item/use-placement-coordinator.tsx index 34d02fae..f1c12000 100644 --- a/apps/editor/components/tools/item/use-placement-coordinator.tsx +++ b/apps/editor/components/tools/item/use-placement-coordinator.tsx @@ -503,12 +503,14 @@ export function usePlacementCoordinator(config: PlacementCoordinatorConfig): Rea if (!asset.attachTo) { const levelId = useViewer.getState().selection.levelId if (levelId) { - mesh.position.y = spatialGridManager.getSlabElevationForItem( + const slabElevation = spatialGridManager.getSlabElevationForItem( levelId, [gridPosition.current.x, gridPosition.current.y, gridPosition.current.z], asset.dimensions ?? DEFAULT_DIMENSIONS, draftNode.current.rotation, ) + mesh.position.y = slabElevation + cursorRef.current.position.y = slabElevation } } } diff --git a/packages/core/src/store/actions/node-actions.ts b/packages/core/src/store/actions/node-actions.ts index 0281729f..5ced050b 100644 --- a/packages/core/src/store/actions/node-actions.ts +++ b/packages/core/src/store/actions/node-actions.ts @@ -97,9 +97,15 @@ export const updateNodesAction = ( return { nodes: nextNodes } }) - // Mark dirty - updates.forEach((u) => get().markDirty(u.id)) - parentsToUpdate.forEach((pId) => get().markDirty(pId)) + // Mark dirty after the next frame to ensure React renders complete + requestAnimationFrame(() => { + updates.forEach((u) => { + get().markDirty(u.id) + }) + parentsToUpdate.forEach((pId) => { + get().markDirty(pId) + }) + }) } export const deleteNodesAction = (