fix placement
This commit is contained in:
@@ -503,12 +503,14 @@ export function usePlacementCoordinator(config: PlacementCoordinatorConfig): Rea
|
|||||||
if (!asset.attachTo) {
|
if (!asset.attachTo) {
|
||||||
const levelId = useViewer.getState().selection.levelId
|
const levelId = useViewer.getState().selection.levelId
|
||||||
if (levelId) {
|
if (levelId) {
|
||||||
mesh.position.y = spatialGridManager.getSlabElevationForItem(
|
const slabElevation = spatialGridManager.getSlabElevationForItem(
|
||||||
levelId,
|
levelId,
|
||||||
[gridPosition.current.x, gridPosition.current.y, gridPosition.current.z],
|
[gridPosition.current.x, gridPosition.current.y, gridPosition.current.z],
|
||||||
asset.dimensions ?? DEFAULT_DIMENSIONS,
|
asset.dimensions ?? DEFAULT_DIMENSIONS,
|
||||||
draftNode.current.rotation,
|
draftNode.current.rotation,
|
||||||
)
|
)
|
||||||
|
mesh.position.y = slabElevation
|
||||||
|
cursorRef.current.position.y = slabElevation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,9 +97,15 @@ export const updateNodesAction = (
|
|||||||
return { nodes: nextNodes }
|
return { nodes: nextNodes }
|
||||||
})
|
})
|
||||||
|
|
||||||
// Mark dirty
|
// Mark dirty after the next frame to ensure React renders complete
|
||||||
updates.forEach((u) => get().markDirty(u.id))
|
requestAnimationFrame(() => {
|
||||||
parentsToUpdate.forEach((pId) => get().markDirty(pId))
|
updates.forEach((u) => {
|
||||||
|
get().markDirty(u.id)
|
||||||
|
})
|
||||||
|
parentsToUpdate.forEach((pId) => {
|
||||||
|
get().markDirty(pId)
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export const deleteNodesAction = (
|
export const deleteNodesAction = (
|
||||||
|
|||||||
Reference in New Issue
Block a user