length가 없는경우 따로 계산 추가
This commit is contained in:
parent
5986fe51ff
commit
94985feed8
@ -159,5 +159,6 @@ export const useLine = () => {
|
||||
addPitchText,
|
||||
removePitchText,
|
||||
addPitchTextsByOuterLines,
|
||||
getLengthByLine,
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user