Skip to content

Commit

Permalink
Multimaterial: trim strings, skip empties
Browse files Browse the repository at this point in the history
  • Loading branch information
ochafik committed Dec 31, 2024
1 parent 5e48ffb commit 6a9529a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/components/MultimaterialColorsDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ export default function MultimaterialColorsDialog() {
<Button
label={state.view.extruderPickerVisibility == 'exporting' ? "Export" : "Save"}
icon="pi pi-check"
disabled={!tempExtruderColors.every(c => chroma.valid(c))}
disabled={!tempExtruderColors.every(c => chroma.valid(c) || c.trim() === '')}
autoFocus
onClick={e => {
model!.mutate(s => {
s.params.extruderColors = tempExtruderColors;
s.params.extruderColors = tempExtruderColors.filter(c => c.trim() !== '');
s.view.extruderPickerVisibility = undefined;
});
if (state.view.extruderPickerVisibility === 'exporting') {
Expand Down Expand Up @@ -84,9 +84,9 @@ export default function MultimaterialColorsDialog() {
}
}}
onChange={(e) => {
let color = e.target.value;
let color = e.target.value.trim();
try {
color = chroma(e.target.value).name();
color = chroma(color).name();
console.log(`color: ${e.target.value} -> ${color}`);
} catch (e) {
// ignore
Expand Down

0 comments on commit 6a9529a

Please sign in to comment.