Skip to content

Commit 41edb07

Browse files
committed
Continue manual cleanup
1 parent 5b87543 commit 41edb07

File tree

4 files changed

+57
-73
lines changed

4 files changed

+57
-73
lines changed

editor/src/dispatcher.rs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,15 @@ impl Dispatcher {
189189
}
190190
Message::Frontend(message) => {
191191
// Handle these messages immediately by returning early
192-
match message {
193-
FrontendMessage::TriggerFontLoad { .. } => {
194-
self.responses.push(message);
195-
self.cleanup_queues(false);
192+
if let FrontendMessage::TriggerFontLoad { .. } = message {
193+
self.responses.push(message);
194+
self.cleanup_queues(false);
196195

197-
// Return early to avoid running the code after the match block
198-
return;
199-
}
200-
_ => {
201-
// `FrontendMessage`s are saved and will be sent to the frontend after the message queue is done being processed
202-
self.responses.push(message);
203-
}
196+
// Return early to avoid running the code after the match block
197+
return;
198+
} else {
199+
// `FrontendMessage`s are saved and will be sent to the frontend after the message queue is done being processed
200+
self.responses.push(message);
204201
}
205202
}
206203
Message::Globals(message) => {

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

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2080,14 +2080,12 @@ impl NodeGraphMessageHandler {
20802080
wire_end: InputConnector::node(wire_end, wire_end_input_index),
20812081
dashed: false,
20822082
}),
2083-
_ => match *input {
2084-
NodeInput::Network { import_index, .. } => Some(FrontendNodeWire {
2085-
wire_start: OutputConnector::Import(import_index),
2086-
wire_end: InputConnector::node(wire_end, wire_end_input_index),
2087-
dashed: false,
2088-
}),
2089-
_ => None,
2090-
},
2083+
NodeInput::Network { import_index, .. } => Some(FrontendNodeWire {
2084+
wire_start: OutputConnector::Import(import_index),
2085+
wire_end: InputConnector::node(wire_end, wire_end_input_index),
2086+
dashed: false,
2087+
}),
2088+
_ => None,
20912089
}
20922090
})
20932091
.collect::<Vec<_>>();
@@ -2114,11 +2112,13 @@ impl NodeGraphMessageHandler {
21142112
wire_end: InputConnector::Export(i),
21152113
dashed,
21162114
});
2117-
} else if let NodeInput::Network { import_index, .. } = *export { wires.push(FrontendNodeWire {
2118-
wire_start: OutputConnector::Import(import_index),
2119-
wire_end: InputConnector::Export(i),
2120-
dashed,
2121-
}) }
2115+
} else if let NodeInput::Network { import_index, .. } = *export {
2116+
wires.push(FrontendNodeWire {
2117+
wire_start: OutputConnector::Import(import_index),
2118+
wire_end: InputConnector::Export(i),
2119+
dashed,
2120+
})
2121+
}
21222122
}
21232123
}
21242124
wires
@@ -2279,19 +2279,12 @@ impl NodeGraphMessageHandler {
22792279
let mut current_network = network_interface.nested_network(&current_network_path).unwrap();
22802280
let mut subgraph_names = vec!["Document".to_string()];
22812281
for node_id in breadcrumb_network_path {
2282-
match current_network.nodes.get(node_id) {
2283-
Some(node) => {
2284-
if let Some(network) = node.implementation.get_network() {
2285-
current_network = network;
2286-
};
2287-
subgraph_names.push(network_interface.frontend_display_name(node_id, &current_network_path));
2288-
current_network_path.push(*node_id)
2289-
}
2290-
_ => {
2291-
// Could not get node in network in breadcrumb_network_path
2292-
return None;
2293-
}
2282+
let node = current_network.nodes.get(node_id)?;
2283+
if let Some(network) = node.implementation.get_network() {
2284+
current_network = network;
22942285
};
2286+
subgraph_names.push(network_interface.frontend_display_name(node_id, &current_network_path));
2287+
current_network_path.push(*node_id)
22952288
}
22962289
Some(subgraph_names)
22972290
}

editor/src/messages/portfolio/document/overlays/grid_overlays.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ pub fn grid_overlay(document: &DocumentMessageHandler, overlay_context: &mut Ove
212212
pub fn overlay_options(grid: &GridSnapping) -> Vec<LayoutGroup> {
213213
let mut widgets = Vec::new();
214214
fn update_val<I, F: Fn(&mut GridSnapping, &I)>(grid: &GridSnapping, update: F) -> impl Fn(&I) -> Message + use<I, F> {
215-
let new_grid = grid.clone();
215+
let grid = grid.clone();
216216
move |input: &I| {
217-
let mut grid = new_grid.clone();
217+
let mut grid = grid.clone();
218218
update(&mut grid, input);
219219
DocumentMessage::GridOptions(grid).into()
220220
}

editor/src/messages/portfolio/document/utility_types/network_interface.rs

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -977,24 +977,21 @@ impl NodeNetworkInterface {
977977
log::error!("Could not get node {node_id} in upstream_nodes_below_layer");
978978
break;
979979
};
980-
match current_node
980+
if let Some(primary_node_id) = current_node
981981
.inputs
982982
.iter()
983983
.filter(|input| input.is_exposed_to_frontend(network_path.is_empty()))
984984
.nth(if self.is_layer(&current_node_id, network_path) { 1 } else { 0 })
985985
.and_then(|left_input| left_input.as_node())
986986
{
987-
Some(primary_node_id) => {
988-
if self.is_chain(&primary_node_id, network_path) {
989-
current_node_id = primary_node_id;
990-
} else {
991-
potential_upstream_nodes.insert(primary_node_id);
992-
break;
993-
}
994-
}
995-
_ => {
987+
if self.is_chain(&primary_node_id, network_path) {
988+
current_node_id = primary_node_id;
989+
} else {
990+
potential_upstream_nodes.insert(primary_node_id);
996991
break;
997992
}
993+
} else {
994+
break;
998995
}
999996
}
1000997

@@ -4680,21 +4677,18 @@ impl NodeNetworkInterface {
46804677
return;
46814678
};
46824679

4683-
match &mut node_metadata.persistent_metadata.node_type_metadata {
4684-
NodeTypePersistentMetadata::Node(node_metadata) => {
4685-
if node_metadata.position == NodePosition::Absolute(position) {
4686-
return;
4687-
}
4688-
node_metadata.position = NodePosition::Absolute(position);
4689-
self.transaction_modified();
4680+
if let NodeTypePersistentMetadata::Node(node_metadata) = &mut node_metadata.persistent_metadata.node_type_metadata {
4681+
if node_metadata.position == NodePosition::Absolute(position) {
4682+
return;
4683+
}
4684+
node_metadata.position = NodePosition::Absolute(position);
4685+
self.transaction_modified();
4686+
} else if let NodeTypePersistentMetadata::Layer(layer_metadata) = &mut node_metadata.persistent_metadata.node_type_metadata {
4687+
if layer_metadata.position == LayerPosition::Absolute(position) {
4688+
return;
46904689
}
4691-
_ => if let NodeTypePersistentMetadata::Layer(layer_metadata) = &mut node_metadata.persistent_metadata.node_type_metadata {
4692-
if layer_metadata.position == LayerPosition::Absolute(position) {
4693-
return;
4694-
}
4695-
layer_metadata.position = LayerPosition::Absolute(position);
4696-
self.transaction_modified();
4697-
},
4690+
layer_metadata.position = LayerPosition::Absolute(position);
4691+
self.transaction_modified();
46984692
}
46994693
}
47004694

@@ -5332,17 +5326,17 @@ impl NodeNetworkInterface {
53325326
}
53335327
_ => {
53345328
if let NodeTypePersistentMetadata::Node(node_metadata) = &mut node_metadata.persistent_metadata.node_type_metadata {
5335-
if let NodePosition::Absolute(node_metadata) = &mut node_metadata.position {
5336-
*node_metadata += shift;
5337-
self.transaction_modified();
5338-
// Unload click targets for all upstream nodes, since they may have been derived from the node that was shifted
5339-
self.unload_upstream_node_click_targets(vec![*node_id], network_path);
5340-
self.try_set_node_to_chain(node_id, network_path);
5341-
} else if let NodePosition::Chain = node_metadata.position {
5342-
self.set_upstream_chain_to_absolute(node_id, network_path);
5343-
self.shift_node(node_id, shift, network_path);
5344-
}
5345-
}
5329+
if let NodePosition::Absolute(node_metadata) = &mut node_metadata.position {
5330+
*node_metadata += shift;
5331+
self.transaction_modified();
5332+
// Unload click targets for all upstream nodes, since they may have been derived from the node that was shifted
5333+
self.unload_upstream_node_click_targets(vec![*node_id], network_path);
5334+
self.try_set_node_to_chain(node_id, network_path);
5335+
} else if let NodePosition::Chain = node_metadata.position {
5336+
self.set_upstream_chain_to_absolute(node_id, network_path);
5337+
self.shift_node(node_id, shift, network_path);
5338+
}
5339+
}
53465340
}
53475341
}
53485342
// Unload click targets for all upstream nodes, since they may have been derived from the node that was shifted

0 commit comments

Comments
 (0)