Automatically create variable for setAngle and setLength (#108)

This commit is contained in:
Kurt Hutten
2023-04-07 01:21:33 +10:00
committed by GitHub
parent 52b2e26ac5
commit 0fa56c3f15
2 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,7 @@ export const SetAngleLengthModal = ({
onReject,
value: initialValue,
valueName,
shouldCreateVariable: initialShouldCreateVariable = false,
}: {
isOpen: boolean
onResolve: (a: {
@ -27,10 +28,13 @@ export const SetAngleLengthModal = ({
onReject: (a: any) => void
value: number
valueName: string
shouldCreateVariable: boolean
}) => {
const [sign, setSign] = useState(Math.sign(Number(initialValue)))
const [value, setValue] = useState(String(initialValue * sign))
const [shouldCreateVariable, setShouldCreateVariable] = useState(false)
const [shouldCreateVariable, setShouldCreateVariable] = useState(
initialShouldCreateVariable
)
const {
prevVariables,