diff --git a/src/hooks/roofcover/useMovementSetting.js b/src/hooks/roofcover/useMovementSetting.js index 1c128133..fdde7314 100644 --- a/src/hooks/roofcover/useMovementSetting.js +++ b/src/hooks/roofcover/useMovementSetting.js @@ -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)