Point-and-click Helix from cylinders (#5979)

This commit is contained in:
Pierre Jacquier
2025-03-26 17:57:30 -04:00
committed by GitHub
parent 4b2c745db5
commit 11160f0b40
11 changed files with 513 additions and 217 deletions

View File

@ -80,7 +80,8 @@ function CommandBarKclInput({
: arg.variableName
}
// or derive it from the previously set value or the argument name
return previouslySetValue && 'variableName' in previouslySetValue
return typeof previouslySetValue === 'object' &&
'variableName' in previouslySetValue
? previouslySetValue.variableName
: arg.name
}, [
@ -96,7 +97,8 @@ function CommandBarKclInput({
)
const [value, setValue] = useState(initialValue)
const [createNewVariable, setCreateNewVariable] = useState(
(previouslySetValue && 'variableName' in previouslySetValue) ||
(typeof previouslySetValue === 'object' &&
'variableName' in previouslySetValue) ||
arg.createVariable === 'byDefault' ||
arg.createVariable === 'force' ||
false
@ -132,7 +134,8 @@ function CommandBarKclInput({
selection: {
anchor: 0,
head:
previouslySetValue && 'valueText' in previouslySetValue
typeof previouslySetValue === 'object' &&
'valueText' in previouslySetValue
? previouslySetValue.valueText.length
: defaultValue.length,
},