diff --git a/src/hooks/roofcover/useRoofAllocationSetting.js b/src/hooks/roofcover/useRoofAllocationSetting.js index 69479eef..70874765 100644 --- a/src/hooks/roofcover/useRoofAllocationSetting.js +++ b/src/hooks/roofcover/useRoofAllocationSetting.js @@ -323,42 +323,19 @@ export function useRoofAllocationSetting(id) { } const drawOriginRoofLine = () => { - // outerLinePoints 배열을 이용하여 빨간색 Line 객체들 생성 - if (outerLinePoints && outerLinePoints.length > 1) { - // 연속된 점들을 연결하여 라인 생성 - for (let i = 0; i < outerLinePoints.length - 1; i++) { - const point1 = outerLinePoints[i] - const point2 = outerLinePoints[i + 1] - - const line = new fabric.Line([point1.x, point1.y, point2.x, point2.y], { - stroke: 'black', - strokeDashArray: [5, 2], - strokeWidth: 1, - selectable: false, - name: 'originRoofOuterLine', - visible: outlineDisplay, - }) - - canvas.add(line) - } - - // 마지막 점과 첫 점을 연결하여 폐곡선 만들기 - if (outerLinePoints.length > 2) { - const lastPoint = outerLinePoints[outerLinePoints.length - 1] - const firstPoint = outerLinePoints[0] - - const closingLine = new fabric.Line([lastPoint.x, lastPoint.y, firstPoint.x, firstPoint.y], { - stroke: 'red', - strokeWidth: 2, - selectable: false, - name: 'originRoofOuterLine', - }) - - canvas.add(closingLine) - } - - canvas.renderAll() - } + const wallLines = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.WALL) + /** 벽면 삭제 */ + wallLines.forEach((wallLine) => { + wallLine.set({ + stroke: 'black', + strokeDashArray: [5, 2], + strokeWidth: 1, + selectable: false, + name: 'originRoofOuterLine', + visible: outlineDisplay, + }) + }) + canvas.renderAll() } /**