Compare commits

..

No commits in common. "916a6caf5afe8b9734fa12da986b5b963e3f7320" and "49253b766846709b0ba3ce4427b777227a2ee8df" have entirely different histories.

2 changed files with 9 additions and 19 deletions

View File

@ -340,19 +340,13 @@ 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') {
if (hasOperation) {
handleCompute(true) //
}
setShowKeypad(false)
setShowKeypad(true)
return
}
@ -366,12 +360,6 @@ export const CalculatorInput = forwardRef(
return
}
// --- ---
if (e.key !== 'Process') { // ()
// e.preventDefault() .
}
e.preventDefault()
const calculator = calculatorRef.current
const { allowDecimal } = options

View File

@ -26,15 +26,17 @@ export default function DoublePitch({ props }) {
arrow2Ref,
} = props
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 getLength2 = () => {
const angle1Value = angle1Ref.current.value
const angle2Value = angle2Ref.current.value
const length1Value = length1Ref.current.value
const arrow1Value = arrow1Ref.current
const arrow2Value = arrow2Ref.current
if (!isNaN(Number(angle1Value)) && !isNaN(Number(length1Value)) && !isNaN(Number(angle2Value)) && arrow1Value) {
if (angle1Value !== 0 && length1Value !== 0 && angle2Value !== 0 && 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))
}
@ -176,7 +178,7 @@ export default function DoublePitch({ props }) {
ref={angle2Ref}
onChange={(value) => {
setAngle2(value)
setLength2(getLength2(angle1Ref.current?.value, value, length1Ref.current?.value))
setLength2(getLength2())
}}
placeholder="45"
onFocus={() => (angle2Ref.current.value = '')}