From 7608cad7484cd51aaadb3dc20291ce78b36f3686 Mon Sep 17 00:00:00 2001 From: wass08 Date: Wed, 25 Feb 2026 14:05:32 +0900 Subject: [PATCH] nice progress on doors --- .../components/ui/panels/door-panel.tsx | 278 +++++++++++++----- packages/core/src/schema/nodes/door.ts | 3 + .../core/src/systems/door/door-system.tsx | 52 +++- 3 files changed, 239 insertions(+), 94 deletions(-) diff --git a/apps/editor/components/ui/panels/door-panel.tsx b/apps/editor/components/ui/panels/door-panel.tsx index 4b35eb5c..b489a45e 100644 --- a/apps/editor/components/ui/panels/door-panel.tsx +++ b/apps/editor/components/ui/panels/door-panel.tsx @@ -91,6 +91,28 @@ export function DoorPanel() { setSelection({ selectedIds: [] }) }, [node, setMovingNode, setSelection]) + const setSegmentColumnRatio = (segIdx: number, colIdx: number, newVal: number) => { + const seg = node!.segments[segIdx]! + const normRatios = (() => { + const sum = seg.columnRatios.reduce((a, b) => a + b, 0) + return seg.columnRatios.map(r => r / sum) + })() + const numCols = normRatios.length + const clamped = Math.max(0.05, Math.min(0.95, newVal)) + const neighborIdx = colIdx < numCols - 1 ? colIdx + 1 : colIdx - 1 + const delta = clamped - normRatios[colIdx]! + const neighborVal = Math.max(0.05, normRatios[neighborIdx]! - delta) + const newRatios = normRatios.map((v, i) => { + if (i === colIdx) return clamped + if (i === neighborIdx) return neighborVal + return v + }) + const updated = node!.segments.map((s, idx) => + idx === segIdx ? { ...s, columnRatios: newRatios } : s, + ) + handleUpdate({ segments: updated }) + } + if (!node || node.type !== 'door' || selectedIds.length !== 1) return null return ( @@ -159,7 +181,7 @@ export function DoorPanel() { handleUpdate({ height: v })} + onChange={(v) => handleUpdate({ height: v, position: [node.position[0], v / 2, node.position[2]] })} min={1.0} precision={2} className="flex-1" @@ -202,6 +224,39 @@ export function DoorPanel() { + {/* Content Padding */} +
+ +
+
+ handleUpdate({ contentPadding: [v, node.contentPadding[1]] })} + min={0} + precision={3} + step={0.005} + className="flex-1" + /> + m +
+
+ handleUpdate({ contentPadding: [node.contentPadding[0], v] })} + min={0} + precision={3} + step={0.005} + className="flex-1" + /> + m +
+
+
+ {/* Swing */}