치수 표기 수정
This commit is contained in:
parent
1df9facaea
commit
1493f9b9d3
@ -1,8 +1,8 @@
|
|||||||
import { useEffect } from 'react'
|
import { useEffect } from 'react'
|
||||||
import { useRecoilValue } from 'recoil'
|
import { useRecoilValue } from 'recoil'
|
||||||
import { wordDisplaySelector } from '@/store/settingAtom'
|
import { wordDisplaySelector } from '@/store/settingAtom'
|
||||||
import { checkLineOrientation, getDistance } from '@/util/canvas-util'
|
|
||||||
import { useEvent } from '@/hooks/useEvent'
|
import { useEvent } from '@/hooks/useEvent'
|
||||||
|
import { checkLineOrientation, getDistance } from '@/util/canvas-util'
|
||||||
|
|
||||||
export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionState }) {
|
export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionState }) {
|
||||||
const wordDisplay = useRecoilValue(wordDisplaySelector)
|
const wordDisplay = useRecoilValue(wordDisplaySelector)
|
||||||
@ -186,7 +186,7 @@ export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionS
|
|||||||
canvas.add(arrow2)
|
canvas.add(arrow2)
|
||||||
|
|
||||||
// 거리 텍스트가 이미 있으면 업데이트하고, 없으면 새로 생성
|
// 거리 텍스트가 이미 있으면 업데이트하고, 없으면 새로 생성
|
||||||
distanceText = new fabric.Text(`${distance}`, {
|
distanceText = new fabric.Text(`${distance * 10} `, {
|
||||||
left: (p1CenterX + p2CenterX) / 2 + (lineDirection === 'horizontal' ? 0 : -15),
|
left: (p1CenterX + p2CenterX) / 2 + (lineDirection === 'horizontal' ? 0 : -15),
|
||||||
top: (p1CenterY + p2CenterY) / 2 + (lineDirection === 'horizontal' ? +15 : 0),
|
top: (p1CenterY + p2CenterY) / 2 + (lineDirection === 'horizontal' ? +15 : 0),
|
||||||
fill: 'black',
|
fill: 'black',
|
||||||
@ -312,19 +312,19 @@ export function useCommonUtils({ canvas, commonFunctionState, setCommonFunctionS
|
|||||||
const distance3 = getDistance(p3.x, p3.y, p1CenterX, p1CenterY)
|
const distance3 = getDistance(p3.x, p3.y, p1CenterX, p1CenterY)
|
||||||
|
|
||||||
// 거리 텍스트가 이미 있으면 업데이트하고, 없으면 새로 생성
|
// 거리 텍스트가 이미 있으면 업데이트하고, 없으면 새로 생성
|
||||||
distanceText = new fabric.Text(`${distance1}`, {
|
distanceText = new fabric.Text(`${distance1 * 10}`, {
|
||||||
left: (p1CenterX + p2CenterX) / 2,
|
left: (p1CenterX + p2CenterX) / 2,
|
||||||
top: (p1CenterY + p2CenterY) / 2,
|
top: (p1CenterY + p2CenterY) / 2,
|
||||||
...textOptions,
|
...textOptions,
|
||||||
})
|
})
|
||||||
canvas.add(distanceText)
|
canvas.add(distanceText)
|
||||||
distanceText = new fabric.Text(`${distance2}`, {
|
distanceText = new fabric.Text(`${distance2 * 10}`, {
|
||||||
left: (p2CenterX + p3.x) / 2,
|
left: (p2CenterX + p3.x) / 2,
|
||||||
top: (p2CenterY + p3.y) / 2,
|
top: (p2CenterY + p3.y) / 2,
|
||||||
...textOptions,
|
...textOptions,
|
||||||
})
|
})
|
||||||
canvas.add(distanceText)
|
canvas.add(distanceText)
|
||||||
distanceText = new fabric.Text(`${distance3}`, {
|
distanceText = new fabric.Text(`${distance3 * 10}`, {
|
||||||
left: (p3.x + p1CenterX) / 2,
|
left: (p3.x + p1CenterX) / 2,
|
||||||
top: (p3.y + p1CenterY) / 2,
|
top: (p3.y + p1CenterY) / 2,
|
||||||
...textOptions,
|
...textOptions,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user