move tool undo stack
This commit is contained in:
@@ -79,11 +79,8 @@ export function usePlacementCoordinator(config: PlacementCoordinatorConfig): Rea
|
||||
|
||||
const draft = draftNode.current
|
||||
if (draft) {
|
||||
// Update ref for validation — no store update during drag
|
||||
Object.assign(draft, result.nodeUpdate)
|
||||
// In move mode, skip store updates — only the ref + mesh matter during drag
|
||||
if (!draftNode.isAdopted) {
|
||||
useScene.getState().updateNode(draft.id, result.nodeUpdate)
|
||||
}
|
||||
}
|
||||
revalidate()
|
||||
}
|
||||
@@ -98,10 +95,9 @@ export function usePlacementCoordinator(config: PlacementCoordinatorConfig): Rea
|
||||
const draft = draftNode.current
|
||||
if (draft) {
|
||||
Object.assign(draft, result.nodeUpdate)
|
||||
if (!draftNode.isAdopted) {
|
||||
// One-time setup: put node in the right parent so it renders correctly
|
||||
useScene.getState().updateNode(draft.id, result.nodeUpdate)
|
||||
}
|
||||
}
|
||||
|
||||
if (!revalidate()) {
|
||||
draftNode.destroy()
|
||||
@@ -212,17 +208,12 @@ export function usePlacementCoordinator(config: PlacementCoordinatorConfig): Rea
|
||||
const rot = result.nodeUpdate?.rotation
|
||||
if (rot) mesh.rotation.y = rot[1]
|
||||
}
|
||||
// In move mode, skip store updates — only the ref + mesh matter during drag
|
||||
if (!draftNode.isAdopted) {
|
||||
if (result.nodeUpdate) {
|
||||
useScene.getState().updateNode(draft.id, result.nodeUpdate)
|
||||
}
|
||||
// Mark parent wall dirty so it rebuilds geometry — no store update needed
|
||||
if (result.dirtyNodeId) {
|
||||
useScene.getState().dirtyNodes.add(result.dirtyNodeId)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const onWallClick = (event: WallEvent) => {
|
||||
const result = wallStrategy.click(getContext(), event, validators)
|
||||
@@ -358,10 +349,7 @@ export function usePlacementCoordinator(config: PlacementCoordinatorConfig): Rea
|
||||
const newRotationY = (currentRotation[1] ?? 0) + rotationDelta
|
||||
draft.rotation = [currentRotation[0], newRotationY, currentRotation[2]]
|
||||
|
||||
// In move mode, skip store update — only the ref + cursor mesh matter during drag
|
||||
if (!draftNode.isAdopted) {
|
||||
useScene.getState().updateNode(draft.id, { rotation: draft.rotation })
|
||||
}
|
||||
// Ref + cursor mesh only — no store update during drag
|
||||
cursorRef.current.rotation.y = newRotationY
|
||||
revalidate()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user