fix placement
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 = (
|
||||
|
||||
Reference in New Issue
Block a user