This commit is contained in:
hyojun.choi 2026-01-08 16:41:18 +09:00
commit 10bdc6e8ab
2 changed files with 19 additions and 9 deletions

View File

@ -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

View File

@ -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 = '')}