Merge branch 'dev' of https://git.hanasys.jp/qcast3/qcast-front into dev
This commit is contained in:
commit
10bdc6e8ab
@ -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
|
||||
|
||||
@ -26,17 +26,15 @@ export default function DoublePitch({ props }) {
|
||||
arrow2Ref,
|
||||
} = props
|
||||
|
||||
const getLength2 = () => {
|
||||
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 = '')}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user