From 3414f2ca3c352bba250ed04a1a97ad82f1a52690 Mon Sep 17 00:00:00 2001 From: yjnoh Date: Tue, 9 Jul 2024 13:46:06 +0900 Subject: [PATCH] =?UTF-8?q?=EC=99=B8=EA=B3=BD=EC=84=A0=20=EC=88=9C?= =?UTF-8?q?=EC=84=9C=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useMode.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/hooks/useMode.js b/src/hooks/useMode.js index d2ebd3dd..62a767a0 100644 --- a/src/hooks/useMode.js +++ b/src/hooks/useMode.js @@ -742,9 +742,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, })) @@ -785,9 +793,6 @@ export function useMode() { y: averageNormal.y / lengthNormal, } - console.log('current', current) - console.log('unitNormal', unitNormal) - // 오프셋 적용 var offsetPoint = { x1: current.x + unitNormal.x * offset, @@ -796,7 +801,7 @@ export function useMode() { offsetPoints.push(offsetPoint) } - + makePolygon(offsetPoints) }