From 00aaea8b9c28d25351079e28d3f232f417de1a55 Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Fri, 17 Jan 2025 13:54:57 +0900 Subject: [PATCH] =?UTF-8?q?=EB=B0=A9=ED=96=A5=ED=85=8D=EC=8A=A4=ED=8A=B8?= =?UTF-8?q?=EB=A7=8C=20=ED=99=95=EC=9D=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/usePolygon.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/hooks/usePolygon.js b/src/hooks/usePolygon.js index 9c690a6b..3e24920c 100644 --- a/src/hooks/usePolygon.js +++ b/src/hooks/usePolygon.js @@ -427,12 +427,13 @@ export const usePolygon = () => { text = '西西南' } - const sameDirectionCnt = canvas.getObjects().filter((obj) => obj.name === POLYGON_TYPE.ROOF && obj.directionText === text) + const sameDirectionCnt = canvas.getObjects().filter((obj) => { + const onlyStrDirection = obj.directionText?.replace(/[0-9]/g, '') + return obj.name === POLYGON_TYPE.ROOF && onlyStrDirection === text + }) text = text + (sameDirectionCnt.length + 1) - polygon.set('directionText', text) - const textObj = new fabric.Text(`${text} (${currentAngleType === ANGLE_TYPE.SLOPE ? arrow.pitch : getDegreeByChon(arrow.pitch)}${pitchText})`, { fontFamily: flowFontOptions.fontFamily.value, fontWeight: flowFontOptions.fontWeight.value.toLowerCase().includes('bold') ? 'bold' : 'normal',