선택된 object 변경 시 ref 초기화

This commit is contained in:
hyojun.choi 2024-11-05 15:51:39 +09:00
parent c05989f6ae
commit d2d6610a9e

View File

@ -74,6 +74,7 @@ export function useMovementSetting(id) {
outerLines.forEach((line) => {
line.set({ stroke: 'black' })
})
clearRef()
if (!currentObject) {
return
}
@ -85,6 +86,21 @@ export function useMovementSetting(id) {
canvas.renderAll()
}, [currentObject])
const clearRef = () => {
if (type === TYPE.FLOW_LINE) {
FLOW_LINE_REF.DOWN_LEFT_INPUT_REF.current.value = ''
FLOW_LINE_REF.UP_RIGHT_INPUT_REF.current.value = ''
FLOW_LINE_REF.DOWN_LEFT_RADIO_REF.current.checked = false
FLOW_LINE_REF.UP_RIGHT_RADIO_REF.current.checked = false
}
if (type === TYPE.UP_DOWN) {
UP_DOWN_REF.UP_INPUT_REF.current.value = ''
UP_DOWN_REF.DOWN_INPUT_REF.current.value = ''
UP_DOWN_REF.UP_RADIO_REF.current.checked = false
UP_DOWN_REF.DOWN_RADIO_REF.current.checked = false
}
}
const mouseMoveEvent = (e) => {
if (typeRef.current === TYPE.FLOW_LINE) {
flowLineEvent(e)