diff --git a/src/hooks/roofcover/useMovementSetting.js b/src/hooks/roofcover/useMovementSetting.js index 7d1d326a..08b31f4d 100644 --- a/src/hooks/roofcover/useMovementSetting.js +++ b/src/hooks/roofcover/useMovementSetting.js @@ -319,6 +319,14 @@ export function useMovementSetting(id) { const roofId = target.attributes.roofId const roof = canvas.getObjects().find((obj) => obj.id === roofId) + + // 현이동, 동이동 추가 + const moveFlowLine = typeRef.current === TYPE.FLOW_LINE ? FLOW_LINE_REF.POINTER_INPUT_REF.current.value : 0 + const moveUpDown = typeRef.current === TYPE.UP_DOWN ? UP_DOWN_REF.POINTER_INPUT_REF.current.value : 0 + roof.moveFlowLine = parseInt(moveFlowLine, 10) || 0; + roof.moveUpDown = parseInt(moveUpDown, 10) || 0; + roof.moveDirect = ""; + roof.moveSelectLine = target; const wall = canvas.getObjects().find((obj) => obj.name === POLYGON_TYPE.WALL && obj.attributes.roofId === roofId) const baseLines = wall.baseLines let targetBaseLines = [] @@ -348,6 +356,7 @@ export function useMovementSetting(id) { ? 'right' : 'left' let checkBaseLines, currentBaseLines + roof.moveDirect = lineVector switch (lineVector) { case 'up': checkBaseLines = baseLines.filter((line) => line.y1 === line.y2 && line.y1 < target.y1) @@ -442,10 +451,17 @@ export function useMovementSetting(id) { let value if (typeRef.current === TYPE.FLOW_LINE) { - value = - FLOW_LINE_REF.FILLED_INPUT_REF.current.value !== '' - ? Big(FLOW_LINE_REF.FILLED_INPUT_REF.current.value).times(2) - : Big(FLOW_LINE_REF.POINTER_INPUT_REF.current.value).times(2) + value = (() => { + const filledValue = FLOW_LINE_REF.FILLED_INPUT_REF.current?.value; + const pointerValue = FLOW_LINE_REF.POINTER_INPUT_REF.current?.value; + + if (filledValue && !isNaN(filledValue) && filledValue.trim() !== '') { + return Big(filledValue).times(2); + } else if (pointerValue && !isNaN(pointerValue) && pointerValue.trim() !== '') { + return Big(pointerValue).times(2); + } + return Big(0); // 기본값으로 0 반환 또는 다른 적절한 기본값 + })(); if (target.y1 === target.y2) { value = value.neg() }