Skip to content

Commit 0707bd5

Browse files
fix: Fill node solid colour backup update
1 parent 21d2994 commit 0707bd5

1 file changed

Lines changed: 29 additions & 26 deletions

File tree

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

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,35 +2483,38 @@ pub(crate) fn fill_properties(node_id: NodeId, context: &mut NodePropertiesConte
24832483
widgets_first_row.push(
24842484
ColorInput::default()
24852485
.value(FillChoiceUI::from(&FillChoice::from(fill.clone())))
2486-
.on_update(move |x: &ColorInput| Message::Batched {
2487-
messages: Box::new([
2488-
match &fill2 {
2489-
Fill::None => NodeGraphMessage::SetInputValue {
2490-
node_id,
2491-
input_index: BackupColorInput::INDEX,
2492-
value: TaggedValue::Color(None),
2493-
}
2494-
.into(),
2495-
Fill::Solid(color) => NodeGraphMessage::SetInputValue {
2496-
node_id,
2497-
input_index: BackupColorInput::INDEX,
2498-
value: TaggedValue::Color(Some(*color)),
2499-
}
2500-
.into(),
2501-
Fill::Gradient(gradient) => NodeGraphMessage::SetInputValue {
2486+
.on_update(move |x: &ColorInput| {
2487+
let new_fill = FillChoice::from(&x.value).to_fill(fill2.as_gradient());
2488+
Message::Batched {
2489+
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+
},
2510+
NodeGraphMessage::SetInputValue {
25022511
node_id,
2503-
input_index: BackupGradientInput::INDEX,
2504-
value: TaggedValue::FillGradient(gradient.clone()),
2512+
input_index: FillInput::<Color>::INDEX,
2513+
value: TaggedValue::Fill(new_fill),
25052514
}
25062515
.into(),
2507-
},
2508-
NodeGraphMessage::SetInputValue {
2509-
node_id,
2510-
input_index: FillInput::<Color>::INDEX,
2511-
value: TaggedValue::Fill(FillChoice::from(&x.value).to_fill(fill2.as_gradient())),
2512-
}
2513-
.into(),
2514-
]),
2516+
]),
2517+
}
25152518
})
25162519
.on_commit(commit_value)
25172520
.widget_instance(),

0 commit comments

Comments
 (0)