Skip to content
This repository has been archived by the owner on Apr 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #61 from bpostlethwaite/reorder-remove-node-responses
Browse files Browse the repository at this point in the history
return disconnect responses before removal response
  • Loading branch information
setzer22 committed Sep 7, 2022
2 parents 4db5eea + 0747ab5 commit d540805
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions egui_node_graph/src/editor_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,17 +242,19 @@ where
}
NodeResponse::DeleteNodeUi(node_id) => {
let (node, disc_events) = self.graph.remove_node(*node_id);
// Pass the disconnection responses first so user code can perform cleanup
// before node removal response.
extra_responses.extend(
disc_events
.into_iter()
.map(|(input, output)| NodeResponse::DisconnectEvent { input, output }),
);
// Pass the full node as a response so library users can
// listen for it and get their user data.
extra_responses.push(NodeResponse::DeleteNodeFull {
node_id: *node_id,
node,
});
extra_responses.extend(
disc_events
.into_iter()
.map(|(input, output)| NodeResponse::DisconnectEvent { input, output }),
);
self.node_positions.remove(*node_id);
// Make sure to not leave references to old nodes hanging
if self.selected_node.map(|x| x == *node_id).unwrap_or(false) {
Expand Down

0 comments on commit d540805

Please sign in to comment.