반영 변경
This commit is contained in:
parent
9683b38cf0
commit
12f442b3ed
@ -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