diff --git a/src/components/common/input/CalcInput.jsx b/src/components/common/input/CalcInput.jsx index 37bd00ef..9cfddfd4 100644 --- a/src/components/common/input/CalcInput.jsx +++ b/src/components/common/input/CalcInput.jsx @@ -340,13 +340,19 @@ export const CalculatorInput = forwardRef( // Tab 키는 계산기 숨기고 기본 동작 허용 if (e.key === 'Tab') { + if (hasOperation) { + handleCompute(true) // 계산 수행 + } setShowKeypad(false) return } // 모든 방향키는 기본 동작 허용 if (e.key === 'ArrowLeft' || e.key === 'ArrowRight' || e.key === 'ArrowUp' || e.key === 'ArrowDown') { - setShowKeypad(true) + if (hasOperation) { + handleCompute(true) // 계산 수행 + } + setShowKeypad(false) return } @@ -360,6 +366,12 @@ export const CalculatorInput = forwardRef( return } + // --- 여기서부터는 브라우저의 기본 입력을 막고 계산기 로직만 적용함 --- + if (e.key !== 'Process') { // 한글 입력 등 특수 상황 방지 (필요시) + // e.preventDefault() 호출 위치를 확인하세요. + } + + e.preventDefault() const calculator = calculatorRef.current const { allowDecimal } = options diff --git a/src/components/estimate/Estimate.jsx b/src/components/estimate/Estimate.jsx index a8f5f148..ee2fab4b 100644 --- a/src/components/estimate/Estimate.jsx +++ b/src/components/estimate/Estimate.jsx @@ -1465,19 +1465,19 @@ export default function Estimate({}) { : 'none', }} > - { - //주문분류 - setHandlePricingFlag(true) - setEstimateContextState({ estimateType: e.target.value, setEstimateContextState }) - }} - /> - + {/* {*/} + {/* //주문분류*/} + {/* setHandlePricingFlag(true)*/} + {/* setEstimateContextState({ estimateType: e.target.value, setEstimateContextState })*/} + {/* }}*/} + {/*/>*/} + {/**/}
{ - const angle1Value = angle1Ref.current.value - const angle2Value = angle2Ref.current.value - const length1Value = length1Ref.current.value + const getLength2 = (angle1, angle2, length1) => { + const angle1Value = angle1 !== undefined ? angle1 : angle1Ref.current?.value + const angle2Value = angle2 !== undefined ? angle2 : angle2Ref.current?.value + const length1Value = length1 !== undefined ? length1 : length1Ref.current?.value const arrow1Value = arrow1Ref.current - const arrow2Value = arrow2Ref.current - if (angle1Value !== 0 && length1Value !== 0 && angle2Value !== 0 && arrow1Value !== '') { + if (!isNaN(Number(angle1Value)) && !isNaN(Number(length1Value)) && !isNaN(Number(angle2Value)) && arrow1Value) { const radian1 = (getDegreeByChon(angle1Value) * Math.PI) / 180 - const radian2 = (getDegreeByChon(angle2Value) * Math.PI) / 180 return Math.floor((Math.tan(radian1) * length1Value) / Math.tan(radian2)) } @@ -178,7 +176,7 @@ export default function DoublePitch({ props }) { ref={angle2Ref} onChange={(value) => { setAngle2(value) - setLength2(getLength2()) + setLength2(getLength2(angle1Ref.current?.value, value, length1Ref.current?.value)) }} placeholder="45" onFocus={() => (angle2Ref.current.value = '')} diff --git a/src/components/floor-plan/modal/lineTypes/RightAngle.jsx b/src/components/floor-plan/modal/lineTypes/RightAngle.jsx index ef2f00e2..a4356b4a 100644 --- a/src/components/floor-plan/modal/lineTypes/RightAngle.jsx +++ b/src/components/floor-plan/modal/lineTypes/RightAngle.jsx @@ -61,28 +61,40 @@ export default function RightAngle({ props }) {