Multimaterial: trim strings, skip empties
This commit is contained in:
parent
5e48ffbf34
commit
6a9529aab7
1 changed files with 4 additions and 4 deletions
|
|
@ -40,11 +40,11 @@ export default function MultimaterialColorsDialog() {
|
||||||
<Button
|
<Button
|
||||||
label={state.view.extruderPickerVisibility == 'exporting' ? "Export" : "Save"}
|
label={state.view.extruderPickerVisibility == 'exporting' ? "Export" : "Save"}
|
||||||
icon="pi pi-check"
|
icon="pi pi-check"
|
||||||
disabled={!tempExtruderColors.every(c => chroma.valid(c))}
|
disabled={!tempExtruderColors.every(c => chroma.valid(c) || c.trim() === '')}
|
||||||
autoFocus
|
autoFocus
|
||||||
onClick={e => {
|
onClick={e => {
|
||||||
model!.mutate(s => {
|
model!.mutate(s => {
|
||||||
s.params.extruderColors = tempExtruderColors;
|
s.params.extruderColors = tempExtruderColors.filter(c => c.trim() !== '');
|
||||||
s.view.extruderPickerVisibility = undefined;
|
s.view.extruderPickerVisibility = undefined;
|
||||||
});
|
});
|
||||||
if (state.view.extruderPickerVisibility === 'exporting') {
|
if (state.view.extruderPickerVisibility === 'exporting') {
|
||||||
|
|
@ -84,9 +84,9 @@ export default function MultimaterialColorsDialog() {
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onChange={(e) => {
|
onChange={(e) => {
|
||||||
let color = e.target.value;
|
let color = e.target.value.trim();
|
||||||
try {
|
try {
|
||||||
color = chroma(e.target.value).name();
|
color = chroma(color).name();
|
||||||
console.log(`color: ${e.target.value} -> ${color}`);
|
console.log(`color: ${e.target.value} -> ${color}`);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// ignore
|
// ignore
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue