Make-cq-customizer-more-resilient (#560)

Was failing when initial values were missing
This commit was merged in pull request #560.
This commit is contained in:
Kurt Hutten
2021-10-16 03:59:19 +11:00
committed by GitHub
parent 50cd44cd76
commit bc1f12971d
2 changed files with 4 additions and 4 deletions

View File

@@ -304,7 +304,7 @@ function NumberParam({
if (typeof param.max === 'number') {
num = Math.min(param.max, num)
}
num = Number(num.toFixed(2))
num = Number((num || 0).toFixed(2))
localValueSetter(num)
onChange(num)
}

View File

@@ -41,21 +41,21 @@ export function CadQueryToCadhubParams(
type: 'number',
input: 'default-number',
...common,
initial: param.initial,
initial: param.initial || 0,
}
case 'string':
return {
type: 'string',
input: 'default-string',
...common,
initial: param.initial,
initial: param.initial || '',
}
case 'boolean':
return {
type: 'boolean',
input: 'default-boolean',
...common,
initial: param.initial,
initial: param.initial || false,
}
}
})