followLine 수정
This commit is contained in:
parent
711e669ec3
commit
8c9aa13edf
@ -180,18 +180,9 @@ export function useMovementSetting(id) {
|
|||||||
name: 'followLine',
|
name: 'followLine',
|
||||||
})
|
})
|
||||||
canvas.add(followLine)
|
canvas.add(followLine)
|
||||||
|
followLine.bringToFront()
|
||||||
FOLLOW_LINE_REF.current = followLine
|
FOLLOW_LINE_REF.current = followLine
|
||||||
|
|
||||||
canvas.on('mouse:move', (event) => {
|
|
||||||
const mousePos = getIntersectMousePoint(event)
|
|
||||||
if (followLine.x1 === followLine.x2) {
|
|
||||||
followLine.left = mousePos.x - 2
|
|
||||||
} else {
|
|
||||||
followLine.top = mousePos.y - 2
|
|
||||||
}
|
|
||||||
canvas.renderAll()
|
|
||||||
})
|
|
||||||
|
|
||||||
canvas.renderAll()
|
canvas.renderAll()
|
||||||
}, [currentObject])
|
}, [currentObject])
|
||||||
|
|
||||||
@ -247,7 +238,9 @@ export function useMovementSetting(id) {
|
|||||||
|
|
||||||
const mouseMoveEvent = (e) => {
|
const mouseMoveEvent = (e) => {
|
||||||
//console.log('mouseMoveEvent:::::',e)
|
//console.log('mouseMoveEvent:::::',e)
|
||||||
const target = canvas.getActiveObject()
|
// 기존에는 activeObject를 사용했으나, 이 기능에서는 선택된 라인을 비선택(selectable:false) 상태로 두므로
|
||||||
|
// 항상 selectedObject.current를 기준으로 계산한다.
|
||||||
|
const target = selectedObject.current
|
||||||
if (!target) return
|
if (!target) return
|
||||||
|
|
||||||
// 디버깅 로그 추가
|
// 디버깅 로그 추가
|
||||||
@ -285,11 +278,23 @@ export function useMovementSetting(id) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// followLine도 포인터를 따라가도록 동기화 (하나의 mouse:move 핸들러만 사용)
|
||||||
|
const followLine = FOLLOW_LINE_REF.current
|
||||||
|
if (followLine) {
|
||||||
|
if (followLine.x1 === followLine.x2) {
|
||||||
|
// 수직 라인: x만 이동
|
||||||
|
followLine.left = currentX.toNumber() - 2
|
||||||
|
} else {
|
||||||
|
// 수평 라인: y만 이동
|
||||||
|
followLine.top = currentY.toNumber() - 2
|
||||||
|
}
|
||||||
|
followLine.bringToFront()
|
||||||
|
followLine.setCoords && followLine.setCoords()
|
||||||
|
canvas.renderAll()
|
||||||
|
}
|
||||||
|
|
||||||
// 방향 정보를 사용하여 라디오 버튼 상태 업데이트
|
// 방향 정보를 사용하여 라디오 버튼 상태 업데이트
|
||||||
|
|
||||||
//console.log(`방향: ${direction}, 값: ${value.toNumber()}`)
|
|
||||||
|
|
||||||
|
|
||||||
currentCalculatedValue = value.toNumber()
|
currentCalculatedValue = value.toNumber()
|
||||||
|
|
||||||
if (typeRef.current === TYPE.FLOW_LINE) {
|
if (typeRef.current === TYPE.FLOW_LINE) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user