length가 없는경우 따로 계산 추가
This commit is contained in:
parent
5986fe51ff
commit
94985feed8
@ -159,5 +159,6 @@ export const useLine = () => {
|
|||||||
addPitchText,
|
addPitchText,
|
||||||
removePitchText,
|
removePitchText,
|
||||||
addPitchTextsByOuterLines,
|
addPitchTextsByOuterLines,
|
||||||
|
getLengthByLine,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import { flowDisplaySelector } from '@/store/settingAtom'
|
|||||||
import { fontSelector } from '@/store/fontAtom'
|
import { fontSelector } from '@/store/fontAtom'
|
||||||
import { QLine } from '@/components/fabric/QLine'
|
import { QLine } from '@/components/fabric/QLine'
|
||||||
import { LINE_TYPE, POLYGON_TYPE } from '@/common/common'
|
import { LINE_TYPE, POLYGON_TYPE } from '@/common/common'
|
||||||
|
import { useLine } from '@/hooks/useLine'
|
||||||
|
|
||||||
export const usePolygon = () => {
|
export const usePolygon = () => {
|
||||||
const canvas = useRecoilValue(canvasState)
|
const canvas = useRecoilValue(canvasState)
|
||||||
@ -24,6 +25,8 @@ export const usePolygon = () => {
|
|||||||
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
|
const currentAngleType = useRecoilValue(currentAngleTypeSelector)
|
||||||
const pitchText = useRecoilValue(pitchTextSelector)
|
const pitchText = useRecoilValue(pitchTextSelector)
|
||||||
|
|
||||||
|
const { getLengthByLine } = useLine()
|
||||||
|
|
||||||
const addPolygon = (points, options, isAddCanvas = true) => {
|
const addPolygon = (points, options, isAddCanvas = true) => {
|
||||||
const polygon = new QPolygon(points, {
|
const polygon = new QPolygon(points, {
|
||||||
...options,
|
...options,
|
||||||
@ -1104,7 +1107,7 @@ export const usePolygon = () => {
|
|||||||
if (!representLine) {
|
if (!representLine) {
|
||||||
representLine = line
|
representLine = line
|
||||||
} else {
|
} else {
|
||||||
if (representLine.length < line.length) {
|
if (getLengthByLine(representLine) < getLengthByLine(line)) {
|
||||||
representLine = line
|
representLine = line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user