fix duplicate door
This commit is contained in:
@@ -204,27 +204,15 @@ export const MoveDoorTool: React.FC<{ node: DoorNode }> = ({ node: movingDoorNod
|
||||
useScene.getState().deleteNode(movingDoorNode.id)
|
||||
useScene.temporal.getState().resume()
|
||||
|
||||
const cloned = structuredClone(movingDoorNode) as any
|
||||
delete cloned.id
|
||||
const node = DoorNode.parse({
|
||||
...cloned,
|
||||
position: [clampedX, clampedY, 0],
|
||||
rotation: [0, itemRotation, 0],
|
||||
side,
|
||||
wallId: event.node.id,
|
||||
parentId: event.node.id,
|
||||
width: movingDoorNode.width,
|
||||
height: movingDoorNode.height,
|
||||
frameThickness: movingDoorNode.frameThickness,
|
||||
frameDepth: movingDoorNode.frameDepth,
|
||||
threshold: movingDoorNode.threshold,
|
||||
thresholdHeight: movingDoorNode.thresholdHeight,
|
||||
hingesSide: movingDoorNode.hingesSide,
|
||||
swingDirection: movingDoorNode.swingDirection,
|
||||
segments: movingDoorNode.segments,
|
||||
handle: movingDoorNode.handle,
|
||||
handleHeight: movingDoorNode.handleHeight,
|
||||
handleSide: movingDoorNode.handleSide,
|
||||
doorCloser: movingDoorNode.doorCloser,
|
||||
panicBar: movingDoorNode.panicBar,
|
||||
panicBarHeight: movingDoorNode.panicBarHeight,
|
||||
})
|
||||
useScene.getState().createNode(node, event.node.id as AnyNodeId)
|
||||
placedId = node.id
|
||||
|
||||
@@ -68,29 +68,10 @@ export function DoorPanel() {
|
||||
if (!node || !node.parentId) return
|
||||
sfxEmitter.emit('sfx:item-pick')
|
||||
useScene.temporal.getState().pause()
|
||||
const duplicate = DoorNode.parse({
|
||||
position: [...node.position] as [number, number, number],
|
||||
rotation: [...node.rotation] as [number, number, number],
|
||||
side: node.side,
|
||||
wallId: node.wallId,
|
||||
parentId: node.parentId,
|
||||
width: node.width,
|
||||
height: node.height,
|
||||
frameThickness: node.frameThickness,
|
||||
frameDepth: node.frameDepth,
|
||||
threshold: node.threshold,
|
||||
thresholdHeight: node.thresholdHeight,
|
||||
hingesSide: node.hingesSide,
|
||||
swingDirection: node.swingDirection,
|
||||
segments: node.segments.map(s => ({ ...s, columnRatios: [...s.columnRatios] })),
|
||||
handle: node.handle,
|
||||
handleHeight: node.handleHeight,
|
||||
handleSide: node.handleSide,
|
||||
doorCloser: node.doorCloser,
|
||||
panicBar: node.panicBar,
|
||||
panicBarHeight: node.panicBarHeight,
|
||||
metadata: { isNew: true },
|
||||
})
|
||||
const cloned = structuredClone(node) as any
|
||||
delete cloned.id
|
||||
cloned.metadata = { ...cloned.metadata, isNew: true }
|
||||
const duplicate = DoorNode.parse(cloned)
|
||||
useScene.getState().createNode(duplicate, node.parentId as AnyNodeId)
|
||||
setMovingNode(duplicate)
|
||||
setSelection({ selectedIds: [] })
|
||||
|
||||
Reference in New Issue
Block a user