qcast-front/.claude/memory/project_hip_pitch_fallback.md

2.4 KiB

name description type
hip pitch 폴백 (planeSize===actualSize 버그 수정) skeleton-utils.js processEavesEdge 의 pitch 폴백 누락으로 hip 의 planeSize===actualSize 가 되어 메뉴 토글이 무효였던 버그 project

skeleton-utils.js:2915 let pitch = outerLine?.attributes?.pitch ?? roof?.pitch ?? 0

Why:

  • 기존: outerLine?.attributes?.pitch ?? 0
  • outerLine.attributes.pitch 누락 시 pitch=0 → addRawLine(line 3396) 의 calcLineActualSize2(deg=0) 은 tan(0)=0 으로 인해 planeSize 와 동일값 반환
  • 결과: SK builder 가 만든 모든 hip 의 attributes.planeSize === attributes.actualSize
  • DIAG 로그 증거: [v1 ext] hip 연장 ... (plane 2615→3322.14, actual 2615→3322.14)
  • 사용자 증상: 伏せ図入력(corridorDimension/planeSize) ↔ 配置面(realDimension/actualSize) 메뉴 토글 시 hip 라벨 숫자 변화 없음

How to apply:

  • usePolygon.js:1649 패턴 (line.pitch ?? represent.pitch ?? globalPitch) 과 동일한 폴백
  • skeleton-utils 는 hook 이 아니라서 globalPitch 직접 접근 불가, 대신 roof.pitch 사용
  • roof 객체는 usePolygon.js:1651-1664 에서 pitch: pitch 로 생성됨
  • 추가 보정 (useRoofAllocationSetting.js handleAlloc) 은 actualSize=0 케이스만 잡으므로 이 근본 수정 후에도 보존 (안전망 역할)
  • useText.js parent.attributes 폴백, useMenu.js 직접 호출, useText DIAG 로그 도 모두 유지
  • 기존 SK 가 pitch=0 으로 빌드된 경우용 즉석 재계산: useText.js recomputeHipActualIfFlat
    • pitch 폴백 체인: line.attributes.pitch → roof.pitch → roof.roofMaterial.pitch → globalPitch ?? 4
    • obj.actualSize 만 갱신 (parent.attributes 갱신 시 fabric set 사이드이펙트 위험)

중요 함정 — lengthText min/max 는 isDiagonal 판정 불가:

  • QLine.js:122-125 가 lengthText 의 minY: this.top, maxY: this.top + this.length 로 설정
  • this.length 는 라인 길이라서 수평 ridge 도 maxY - minY = length > 0
  • 즉 lengthText 의 minX/maxX/minY/maxY 로 dx,dy 구해서 dx>0 && dy>0 으로 판정하면 수평/수직 ridge 까지 hip 으로 잘못 분류됨 → ridge 가 재계산/그룹통일 대상이 되어 토글 시 값 변경 / 다른 라인 값으로 덮어쓰기 발생
  • 반드시 parent QLine 의 x1/y1/x2/y2 로 직접 dx,dy 계산 (임계 5.0 mm)
  • QPolygon.js:712-734 path (Math.min/max(start,end)) 는 정확하지만 QLine path 는 부정확