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,