diff --git a/src/hooks/useMode.js b/src/hooks/useMode.js index 11c0fceb..5e816a72 100644 --- a/src/hooks/useMode.js +++ b/src/hooks/useMode.js @@ -741,9 +741,17 @@ export function useMode() { const handleOuterlinesTest = () => { var offsetPoints = [] - let offset = -35.5 // == 100 - 29 + let offset = 71 // == 100 - 29 - const points = historyLines.current.map((line) => ({ + const sortedIndex = getStartIndex(historyLines.current) + let tmpArraySorted = rearrangeArray(historyLines.current, sortedIndex) + + if (tmpArraySorted[0].direction === 'right') { + //시계방향 + tmpArraySorted = tmpArraySorted.reverse() //그럼 배열을 거꾸로 만들어서 무조건 반시계방향으로 배열 보정 + } + + const points = tmpArraySorted.map((line) => ({ x: line.x1, y: line.y1, })) @@ -784,9 +792,6 @@ export function useMode() { y: averageNormal.y / lengthNormal, } - console.log('current', current) - console.log('unitNormal', unitNormal) - // 오프셋 적용 var offsetPoint = { x1: current.x + unitNormal.x * offset, @@ -795,7 +800,7 @@ export function useMode() { offsetPoints.push(offsetPoint) } - + makePolygon(offsetPoints) }