[2173] junction-extended 패턴 outer hip 제거 + strokeWidth SK와 통일

[작업내용] :
- 대전제 반영: 케라바 ridge 가 생기는 분기에서 c1·c2 에 붙은 outer hip 2개 제거
  · inner hip(junction 너머) 보존
  · __removedHipsSnapshot 첨부 → revert 시 hip 2개 자동 복원
- revert 분기에서 hip 스냅샷 + ridge 스냅샷 둘 다 순회 복원하도록 대칭 보강
- 케라바 패턴 생성 라인 strokeWidth 2 → 4 (SK 라인과 동일, 6개소)
This commit is contained in:
ysCha 2026-05-20 08:46:43 +09:00
parent eb12b24138
commit dc857b28fa

View File

@ -637,7 +637,7 @@ export function useEavesGableEdit(id) {
parentId: roof.id,
fontSize: roof.fontSize,
stroke: '#1083E3',
strokeWidth: 2,
strokeWidth: 4,
name: LINE_TYPE.SUBLINE.HIP,
textMode: roof.textMode,
attributes: { roofId: roof.id, planeSize: sz, actualSize: sz, ...snap.attributes },
@ -653,7 +653,7 @@ export function useEavesGableEdit(id) {
parentId: roof.id,
fontSize: roof.fontSize,
stroke: '#1083E3',
strokeWidth: 2,
strokeWidth: 4,
name: LINE_TYPE.SUBLINE.HIP,
textMode: roof.textMode,
attributes: { roofId: roof.id, planeSize: sz, actualSize: sz },
@ -667,7 +667,7 @@ export function useEavesGableEdit(id) {
hip.attributes = { ...hip.attributes, ...snap.attributes, planeSize: ns, actualSize: ns }
}
// junctionExtended: 추가만 했으므로 추가된 ext hip 2개 + ridge 1개 제거 + 제거됐던 RG-1 복원
// junctionExtended: ext hip 2개 + ridge 1개 제거 + 제거됐던 RG-1 + outer/inner hip 4개 복원
if (ridgeAtMid.ridge.__patternKind === 'junctionExtended') {
const extHips = Array.isArray(ridgeAtMid.ridge.__patternExtHips) ? ridgeAtMid.ridge.__patternExtHips : []
extHips.forEach((h) => {
@ -675,10 +675,11 @@ export function useEavesGableEdit(id) {
removeLine(h)
roof.innerLines = roof.innerLines.filter((il) => il !== h)
})
const removedSnaps = Array.isArray(ridgeAtMid.ridge.__removedRidgesSnapshot) ? ridgeAtMid.ridge.__removedRidgesSnapshot : []
const removedRidgeSnaps = Array.isArray(ridgeAtMid.ridge.__removedRidgesSnapshot) ? ridgeAtMid.ridge.__removedRidgesSnapshot : []
const removedHipSnaps = Array.isArray(ridgeAtMid.ridge.__removedHipsSnapshot) ? ridgeAtMid.ridge.__removedHipsSnapshot : []
removeLine(ridgeAtMid.ridge)
roof.innerLines = roof.innerLines.filter((il) => il !== ridgeAtMid.ridge)
removedSnaps.forEach((snap) => {
removedRidgeSnaps.forEach((snap) => {
if (!snap) return
const pts = [snap.x1, snap.y1, snap.x2, snap.y2]
const sz = calcLinePlaneSize({ x1: pts[0], y1: pts[1], x2: pts[2], y2: pts[3] })
@ -686,7 +687,7 @@ export function useEavesGableEdit(id) {
parentId: roof.id,
fontSize: roof.fontSize,
stroke: '#1083E3',
strokeWidth: 2,
strokeWidth: 4,
name: LINE_TYPE.SUBLINE.RIDGE,
textMode: roof.textMode,
attributes: { roofId: roof.id, planeSize: sz, actualSize: sz, ...snap.attributes },
@ -696,6 +697,13 @@ export function useEavesGableEdit(id) {
restored.bringToFront()
roof.innerLines.push(restored)
})
removedHipSnaps.forEach((snap) => {
if (!snap) return
const hip = buildHipFromSnapshot(snap)
canvas.add(hip)
hip.bringToFront()
roof.innerLines.push(hip)
})
removeKerabHalfLabels(target.id)
hideOriginalLengthText(target.id, false)
canvas.renderAll()
@ -819,7 +827,7 @@ export function useEavesGableEdit(id) {
parentId: roof.id,
fontSize: roof.fontSize,
stroke: '#1083E3',
strokeWidth: 2,
strokeWidth: 4,
name: LINE_TYPE.SUBLINE.RIDGE,
textMode: roof.textMode,
attributes: { roofId: roof.id, planeSize: sz, actualSize: sz },
@ -862,7 +870,7 @@ export function useEavesGableEdit(id) {
parentId: roof.id,
fontSize: roof.fontSize,
stroke: '#1083E3',
strokeWidth: 2,
strokeWidth: 4,
name: LINE_TYPE.SUBLINE.RIDGE,
textMode: roof.textMode,
attributes: { roofId: roof.id, planeSize: ridgeSz, actualSize: ridgeSz },
@ -878,7 +886,7 @@ export function useEavesGableEdit(id) {
parentId: roof.id,
fontSize: roof.fontSize,
stroke: '#1083E3',
strokeWidth: 2,
strokeWidth: 4,
name: LINE_TYPE.SUBLINE.HIP,
textMode: roof.textMode,
attributes: { roofId: roof.id, planeSize: sz, actualSize: sz },
@ -916,6 +924,21 @@ export function useEavesGableEdit(id) {
roof.innerLines = roof.innerLines.filter((il) => !ridgesToRemove.includes(il))
}
// [2240 KERAB-HIP-REMOVE 2026-05-19] 대전제: 케라바 외곽선 양 끝점(c1·c2) 에 붙은 hip 만 제거.
// outer1 (c1↔junction1), outer2 (c2↔junction2) — 사용자 선택 처마 양 끝점에서 만나는 hip
// inner (junction 너머) 는 보존. orphan extension 동반 정리, 스냅샷 첨부.
const hipsToRemove = [jp.outer1, jp.outer2]
ridge.__removedHipsSnapshot = hipsToRemove.map(snapshotHip)
for (const hip of hipsToRemove) {
removeOrphanExtensionsForHip(hip)
removeLine(hip)
}
roof.innerLines = roof.innerLines.filter((il) => !hipsToRemove.includes(il))
logger.log('[KERAB-HIP-REMOVE] outer only', {
outer1: `(${Math.round(jp.outer1.x1)},${Math.round(jp.outer1.y1)})→(${Math.round(jp.outer1.x2)},${Math.round(jp.outer1.y2)})`,
outer2: `(${Math.round(jp.outer2.x1)},${Math.round(jp.outer2.y1)})→(${Math.round(jp.outer2.x2)},${Math.round(jp.outer2.y2)})`,
})
canvas.add(ext1)
canvas.add(ext2)
canvas.add(ridge)