필요 없는 내용 삭제
This commit is contained in:
parent
002a895910
commit
d0541b161d
@ -176,7 +176,6 @@ export function useCanvas(id) {
|
|||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
name: 'mouseLine',
|
name: 'mouseLine',
|
||||||
strokeDashArray: [5, 5],
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -188,7 +187,6 @@ export function useCanvas(id) {
|
|||||||
strokeWidth: 1,
|
strokeWidth: 1,
|
||||||
selectable: false,
|
selectable: false,
|
||||||
name: 'mouseLine',
|
name: 'mouseLine',
|
||||||
strokeDashArray: [5, 5],
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -62,38 +62,6 @@ export function useMode() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const editMode = () => {
|
const editMode = () => {
|
||||||
let distanceText = null // 거리를 표시하는 텍스트 객체를 저장할 변수
|
|
||||||
canvas?.on('mouse:move', function (options) {
|
|
||||||
const pointer = canvas?.getPointer(options.e)
|
|
||||||
|
|
||||||
if (historyLines.current.length === 0) return
|
|
||||||
const direction = getDirection(historyLines.current[0], pointer)
|
|
||||||
|
|
||||||
// 각 선과 마우스 위치 사이의 거리를 계산합니다.
|
|
||||||
const dx = historyLines.current[0].x1 - pointer.x
|
|
||||||
const dy = 0
|
|
||||||
|
|
||||||
const minDistance = Math.sqrt(dx * dx + dy * dy)
|
|
||||||
|
|
||||||
// 거리를 표시하는 텍스트 객체를 생성하거나 업데이트합니다.
|
|
||||||
if (distanceText) {
|
|
||||||
distanceText.set({
|
|
||||||
left: pointer.x,
|
|
||||||
top: pointer.y,
|
|
||||||
text: `${minDistance.toFixed(2)}`,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
distanceText = new fabric.Text(`${minDistance.toFixed(2)}`, {
|
|
||||||
left: pointer.x,
|
|
||||||
top: pointer.y,
|
|
||||||
fontSize: fontSize,
|
|
||||||
})
|
|
||||||
canvas?.add(distanceText)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 캔버스를 다시 그립니다.
|
|
||||||
canvas?.renderAll()
|
|
||||||
})
|
|
||||||
canvas?.on('mouse:down', function (options) {
|
canvas?.on('mouse:down', function (options) {
|
||||||
const pointer = canvas?.getPointer(options.e)
|
const pointer = canvas?.getPointer(options.e)
|
||||||
const circle = new fabric.Circle({
|
const circle = new fabric.Circle({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user