dev #931

Merged
ysCha merged 95 commits from dev into prd-deploy 2026-06-23 17:47:25 +09:00
Showing only changes of commit dd39e6f07b - Show all commits

View File

@ -323,8 +323,11 @@ export function useUndoRedo() {
const cells = roofs.filter((obj) => obj.cells && obj.cells.length > 0)
setDrewRoofCells(cells)
// loadFromJSON 후 QPolygon/QLine 의 lengthText 가 orphan 제거되었을 수 있으므로 재생성
// (initLines 로 새 QLine 이 만들어지면 기존 lengthText 의 parentId 가 안 맞음)
// loadFromJSON 후 QPolygon 의 내부 lines 배열은 plain object 로만 복원되므로
// initLines() 로 실제 QLine 인스턴스를 재구축한다.
// (lengthText 는 JSON 에서 이미 복원되므로 재생성하지 않는다.
// 과거에는 addLengthText 도 함께 호출했으나, undo/redo 반복 시 숨겨진 모서리 라인의
// 텍스트가 누적 생성되어 "707" 같은 잔존 텍스트가 화면에 나타나는 문제가 있었음)
const shouldRebuildText = (poly) =>
poly.type === 'QPolygon' &&
poly.name !== 'arrow' &&
@ -336,11 +339,10 @@ export function useUndoRedo() {
qPolygons.forEach((polygon) => {
try {
polygon.initLines()
polygon.addLengthText()
} catch (e) { /* skip */ }
})
// Group 내부 QPolygon(도머 등)의 lengthText 도 동일하게 재생성
// Group 내부 QPolygon(도머 등)도 동일하게 내부 라인 인스턴스만 재구축한다.
objects
.filter((obj) => obj.type === 'group' && obj._objects)
.forEach((group) => {
@ -349,21 +351,10 @@ export function useUndoRedo() {
try {
if (!child.canvas) child.canvas = canvas
child.initLines?.()
child.addLengthText?.()
} catch (e) { /* skip */ }
}
})
})
canvas.getObjects()
.filter((obj) => obj.type === 'QLine')
.forEach((line) => {
try {
if (typeof line.addLengthText === 'function') {
line.addLengthText()
}
} catch (e) { /* skip */ }
})
}, [canvas, rebuildObjectGraph])
const restoreAtomSnapshot = useCallback((atomSnapshot) => {