From 94985feed8eb993ecdf61f2c70179f40fdd5dc5f Mon Sep 17 00:00:00 2001 From: "hyojun.choi" Date: Fri, 30 May 2025 17:29:37 +0900 Subject: [PATCH] =?UTF-8?q?length=EA=B0=80=20=EC=97=86=EB=8A=94=EA=B2=BD?= =?UTF-8?q?=EC=9A=B0=20=EB=94=B0=EB=A1=9C=20=EA=B3=84=EC=82=B0=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useLine.js | 1 + src/hooks/usePolygon.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hooks/useLine.js b/src/hooks/useLine.js index fcf14312..9d1a48eb 100644 --- a/src/hooks/useLine.js +++ b/src/hooks/useLine.js @@ -159,5 +159,6 @@ export const useLine = () => { addPitchText, removePitchText, addPitchTextsByOuterLines, + getLengthByLine, } } diff --git a/src/hooks/usePolygon.js b/src/hooks/usePolygon.js index 39e82210..558bec36 100644 --- a/src/hooks/usePolygon.js +++ b/src/hooks/usePolygon.js @@ -15,6 +15,7 @@ import { flowDisplaySelector } from '@/store/settingAtom' import { fontSelector } from '@/store/fontAtom' import { QLine } from '@/components/fabric/QLine' import { LINE_TYPE, POLYGON_TYPE } from '@/common/common' +import { useLine } from '@/hooks/useLine' export const usePolygon = () => { const canvas = useRecoilValue(canvasState) @@ -24,6 +25,8 @@ export const usePolygon = () => { const currentAngleType = useRecoilValue(currentAngleTypeSelector) const pitchText = useRecoilValue(pitchTextSelector) + const { getLengthByLine } = useLine() + const addPolygon = (points, options, isAddCanvas = true) => { const polygon = new QPolygon(points, { ...options, @@ -1104,7 +1107,7 @@ export const usePolygon = () => { if (!representLine) { representLine = line } else { - if (representLine.length < line.length) { + if (getLengthByLine(representLine) < getLengthByLine(line)) { representLine = line } }