Skip to content

Commit f34b995

Browse files
chore: refactor
1 parent 0707bd5 commit f34b995

1 file changed

Lines changed: 11 additions & 20 deletions

File tree

editor/src/messages/portfolio/document/node_graph/node_properties.rs

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,28 +2485,19 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte
24852485
.value(FillChoiceUI::from(&FillChoice::from(fill.clone())))
24862486
.on_update(move |x: &ColorInput| {
24872487
let new_fill = FillChoice::from(&x.value).to_fill(fill2.as_gradient());
2488+
let (backup_index, backup_value) = match &new_fill {
2489+
Fill::None => (BackupColorInput::INDEX, TaggedValue::Color(None)),
2490+
Fill::Solid(color) => (BackupColorInput::INDEX, TaggedValue::Color(Some(*color))),
2491+
Fill::Gradient(gradient) => (BackupGradientInput::INDEX, TaggedValue::FillGradient(gradient.clone())),
2492+
};
24882493
Message::Batched {
24892494
messages: Box::new([
2490-
match &new_fill {
2491-
Fill::None => NodeGraphMessage::SetInputValue {
2492-
node_id,
2493-
input_index: BackupColorInput::INDEX,
2494-
value: TaggedValue::Color(None),
2495-
}
2496-
.into(),
2497-
Fill::Solid(color) => NodeGraphMessage::SetInputValue {
2498-
node_id,
2499-
input_index: BackupColorInput::INDEX,
2500-
value: TaggedValue::Color(Some(*color)),
2501-
}
2502-
.into(),
2503-
Fill::Gradient(gradient) => NodeGraphMessage::SetInputValue {
2504-
node_id,
2505-
input_index: BackupGradientInput::INDEX,
2506-
value: TaggedValue::FillGradient(gradient.clone()),
2507-
}
2508-
.into(),
2509-
},
2495+
NodeGraphMessage::SetInputValue {
2496+
node_id,
2497+
input_index: backup_index,
2498+
value: backup_value,
2499+
}
2500+
.into(),
25102501
NodeGraphMessage::SetInputValue {
25112502
node_id,
25122503
input_index: FillInput::<Color>::INDEX,

0 commit comments

Comments
 (0)