diff --git a/src/hooks/roofcover/useAuxiliaryDrawing.js b/src/hooks/roofcover/useAuxiliaryDrawing.js index 72b094c9..46311ad9 100644 --- a/src/hooks/roofcover/useAuxiliaryDrawing.js +++ b/src/hooks/roofcover/useAuxiliaryDrawing.js @@ -616,6 +616,37 @@ export function useAuxiliaryDrawing(id) { removeLine(line1) intersectionPoints.current.push(...interSectionPointsWithRoofLines) return + } else if (interSectionPointsWithRoofLines.length === 1) { + //지붕선과 만나는 점이 하나일 경우 + const distance1 = distanceBetweenPoints({ x: line1.x1, y: line1.y1 }, interSectionPointsWithRoofLines[0]) + const distance2 = distanceBetweenPoints({ x: line1.x2, y: line1.y2 }, interSectionPointsWithRoofLines[0]) + + if (!(distance1 === 0 || distance2 === 0)) { + if (distance1 >= distance2) { + const newLine = addLine([line1.x1, line1.y1, interSectionPointsWithRoofLines[0].x, interSectionPointsWithRoofLines[0].y], { + stroke: 'black', + strokeWidth: 1, + selectable: false, + name: 'auxiliaryLine', + isFixed: true, + }) + lineHistory.current.push(newLine) + lineHistory.current = lineHistory.current.filter((history) => history !== line1) + removeLine(line1) + } else { + const newLine = addLine([line1.x2, line1.y2, interSectionPointsWithRoofLines[0].x, interSectionPointsWithRoofLines[0].y], { + stroke: 'black', + strokeWidth: 1, + selectable: false, + name: 'auxiliaryLine', + isFixed: true, + }) + lineHistory.current.push(newLine) + lineHistory.current = lineHistory.current.filter((history) => history !== line1) + removeLine(line1) + } + intersectionPoints.current.push(interSectionPointsWithRoofLines[0]) + } } //보조선과 만나는 점을 찾는다. diff --git a/src/util/qpolygon-utils.js b/src/util/qpolygon-utils.js index a574c393..1e82aefb 100644 --- a/src/util/qpolygon-utils.js +++ b/src/util/qpolygon-utils.js @@ -1461,7 +1461,6 @@ export const drawRidgeRoof = (roofId, canvas) => { * @param canvas */ const drawRidge = (roof, canvas) => { - debugger const wallLines = canvas?.getObjects().find((object) => object.name === POLYGON_TYPE.WALL && object.attributes.roofId === roof.id).lines // 외벽의 라인 const roofLines = roof.lines // 지붕의 라인 let ridgeRoof = []