From b4f2272a6b4a2f3851f045ac693f413c9732a814 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Tue, 11 Feb 2025 13:41:33 +0900 Subject: [PATCH] =?UTF-8?q?polygon=EC=9D=98=20point=EA=B0=80=203=EA=B0=9C?= =?UTF-8?q?=20=EB=AF=B8=EB=A7=8C=EC=9D=BC=20=EA=B2=BD=EC=9A=B0=20=EC=B2=98?= =?UTF-8?q?=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/common/useRoofFn.js | 4 +++- src/hooks/module/useOrientation.js | 4 ++-- src/hooks/usePolygon.js | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/hooks/common/useRoofFn.js b/src/hooks/common/useRoofFn.js index 54ebaecb..35ec81df 100644 --- a/src/hooks/common/useRoofFn.js +++ b/src/hooks/common/useRoofFn.js @@ -33,6 +33,9 @@ export function useRoofFn() { if (!polygon) { return } + if (polygon.points.length < 3) { + return + } if (isForceChange && !isDisplay) { /*if (polygon.roofMaterial) { polygon.roofMaterial = null @@ -156,7 +159,6 @@ export function useRoofFn() { combinedPatternCanvas.width = polygon.width * ratio combinedPatternCanvas.height = polygon.height * ratio const combinedCtx = combinedPatternCanvas.getContext('2d') - // 첫 번째 패턴을 그린 후 두 번째 패턴을 덧입힘 combinedCtx.drawImage(patternSourceCanvas, 0, 0) combinedCtx.drawImage(hachingPatternSourceCanvas, 0, 0) diff --git a/src/hooks/module/useOrientation.js b/src/hooks/module/useOrientation.js index 36b4e640..9e57c687 100644 --- a/src/hooks/module/useOrientation.js +++ b/src/hooks/module/useOrientation.js @@ -12,7 +12,7 @@ export function useOrientation() { const { drawDirectionArrow } = usePolygon() - useEffect(() => { + /*useEffect(() => { const roofs = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF) roofs.forEach((roof) => { roof.set({ @@ -20,7 +20,7 @@ export function useOrientation() { }) drawDirectionArrow(roof) }) - }, []) + }, [])*/ const nextStep = () => { if (isNaN(compasDeg)) { diff --git a/src/hooks/usePolygon.js b/src/hooks/usePolygon.js index 309688a7..2a024626 100644 --- a/src/hooks/usePolygon.js +++ b/src/hooks/usePolygon.js @@ -174,6 +174,9 @@ export const usePolygon = () => { * @param polygon */ const drawDirectionArrow = (polygon) => { + if (polygon.points.length < 3) { + return + } const direction = polygon.direction if (!direction) { return