length가 없는경우 따로 계산 추가

This commit is contained in:
hyojun.choi 2025-05-30 17:29:37 +09:00
parent 5986fe51ff
commit 94985feed8
2 changed files with 5 additions and 1 deletions

View File

@ -159,5 +159,6 @@ export const useLine = () => {
addPitchText,
removePitchText,
addPitchTextsByOuterLines,
getLengthByLine,
}
}

View File

@ -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
}
}