From 956576491264ff13c29fe94e0e54d6feed8f2840 Mon Sep 17 00:00:00 2001 From: ysCha Date: Thu, 4 Jun 2026 17:19:53 +0900 Subject: [PATCH] =?UTF-8?q?[0000]=20=EC=BC=80=EB=9D=BC=EB=B0=94=20kLine=20?= =?UTF-8?q?=E2=80=94=20wLine=20=EC=9D=B4=EB=8F=99=20=ED=9B=84=20baseLine?= =?UTF-8?q?=20=EB=81=9D=EC=A0=90(t1/t2)=20=EA=B8=B0=EC=A4=80=EC=9C=BC?= =?UTF-8?q?=EB=A1=9C=20foot=20=EA=B3=84=EC=82=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wLine 이동 후 케라바 변경 시 선택된 target 은 이동 전 wallLine 좌표를 가짐. wall.baseLines 에서 wallId 매칭으로 이동된 실제 끝점(t1/t2)을 찾아 kLine foot 계산 기준으로 사용 → 이상한 대각선 수정. Co-Authored-By: Claude Sonnet 4.6 --- src/hooks/roofcover/useEavesGableEdit.js | 26 +++++++++++++++--------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/hooks/roofcover/useEavesGableEdit.js b/src/hooks/roofcover/useEavesGableEdit.js index 7b5b5f40..eb0938d7 100644 --- a/src/hooks/roofcover/useEavesGableEdit.js +++ b/src/hooks/roofcover/useEavesGableEdit.js @@ -364,8 +364,12 @@ export function useEavesGableEdit(id) { } } const labelOf = (line) => (line ? labelByLine.get(line) || '?' : null) - const t1 = { x: target.x1, y: target.y1 } - const t2 = { x: target.x2, y: target.y2 } + // [KERAB-WLINE-T1T2 2026-06-04] wLine 이동 후 선택된 target 은 이동 전 wallLine. + // 이동된 실제 위치는 wall.baseLines 중 wallId 가 일치하는 baseLine 에 있다. + const _wall = canvas.getObjects().find((o) => o.name === POLYGON_TYPE.WALL && o.attributes?.roofId === target.attributes?.roofId) + const _matchedBase = _wall?.baseLines?.find((bl) => bl.attributes?.wallId === target.attributes?.wallId) + const t1 = _matchedBase ? { x: _matchedBase.x1, y: _matchedBase.y1 } : { x: target.x1, y: target.y1 } + const t2 = _matchedBase ? { x: _matchedBase.x2, y: _matchedBase.y2 } : { x: target.x2, y: target.y2 } const h1Match = findHipAtEndpoint(roof, t1) const h2Match = findHipAtEndpoint(roof, t2) logger.log( @@ -734,11 +738,13 @@ export function useEavesGableEdit(id) { return Math.abs((vax * vbx + vay * vby) / (ma * mb)) < PERP_EPS } const computePendingKLine = (apex) => { - const ax = h2Match.near.x - h1Match.near.x - const ay = h2Match.near.y - h1Match.near.y + // [KERAB-WLINE-T1T2 2026-06-04] wLine 이동 후 hip.near 가 target 끝점에서 벗어나므로 + // 이동한 처마라인 끝점(t1/t2) 기준으로 foot 계산 + const ax = t2.x - t1.x + const ay = t2.y - t1.y const aSq = ax * ax + ay * ay || 1 - const tFoot = ((apex.x - h1Match.near.x) * ax + (apex.y - h1Match.near.y) * ay) / aSq - const foot = { x: h1Match.near.x + tFoot * ax, y: h1Match.near.y + tFoot * ay } + const tFoot = ((apex.x - t1.x) * ax + (apex.y - t1.y) * ay) / aSq + const foot = { x: t1.x + tFoot * ax, y: t1.y + tFoot * ay } return { x1: apex.x, y1: apex.y, x2: foot.x, y2: foot.y } } const pushApexIfNew = (point, callerTag = '?') => { @@ -1492,8 +1498,8 @@ export function useEavesGableEdit(id) { roof, target, markerApex, - h1Match.near, - h2Match.near, + t1, + t2, [h1Match.hip, h2Match.hip, ...pathHips], pathRidges, extLines, @@ -2160,8 +2166,8 @@ export function useEavesGableEdit(id) { roof, target, apex, - h1Match.near, - h2Match.near, + t1, + t2, [h1Match.hip, h2Match.hip], null, null,