diff --git a/src/hooks/usePolygon.js b/src/hooks/usePolygon.js index bcaec973..39e82210 100644 --- a/src/hooks/usePolygon.js +++ b/src/hooks/usePolygon.js @@ -1093,14 +1093,12 @@ export const usePolygon = () => { }) if (startFlag && endFlag) { - if (!representLines.includes(line)) { + if (!representLines.includes(line) && line.attributes.type === LINE_TYPE.WALLLINE.EAVES) { representLines.push(line) } } }) - // blue로 생성된 것들은 대표라인이 될 수 없음. - representLines = representLines.filter((line) => line.stroke !== 'blue') // representLines중 가장 긴 line을 찾는다. representLines.forEach((line) => { if (!representLine) { @@ -1111,7 +1109,21 @@ export const usePolygon = () => { } } }) - const direction = polygon.direction ?? representLine?.direction + + if (!representLine) { + representLines = representLines.filter((line) => line.stroke !== 'blue') + representLines.forEach((line) => { + if (!representLine) { + representLine = line + } else { + if (representLine.length < line.length) { + representLine = line + } + } + }) + } + + const direction = polygon.direction ?? representLine?.direction ?? '' const polygonDirection = polygon.direction switch (direction) {