Skip to content

Commit e7561c2

Browse files
committed
Run graph when deleting
1 parent a292c5a commit e7561c2

File tree

5 files changed

+18
-6
lines changed

5 files changed

+18
-6
lines changed

editor/src/messages/portfolio/document/document_message_handler.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,9 @@ impl MessageHandler<DocumentMessage, DocumentMessageData<'_>> for DocumentMessag
11141114
node_ids: vec![layer.to_node()],
11151115
delete_children: true,
11161116
});
1117+
responses.add(NodeGraphMessage::RunDocumentGraph);
1118+
responses.add(NodeGraphMessage::SelectedNodesUpdated);
1119+
responses.add(NodeGraphMessage::SendGraph);
11171120
}
11181121
DocumentMessage::PTZUpdate => {
11191122
if !self.graph_view_overlay_open {

editor/src/messages/portfolio/document/graph_operation/graph_operation_message_handler.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,9 @@ impl MessageHandler<GraphOperationMessage, GraphOperationMessageData<'_>> for Gr
206206
});
207207
}
208208
// TODO: Replace deleted artboards with merge nodes
209+
responses.add(NodeGraphMessage::RunDocumentGraph);
210+
responses.add(NodeGraphMessage::SelectedNodesUpdated);
211+
responses.add(NodeGraphMessage::SendGraph);
209212
}
210213
GraphOperationMessage::NewSvg {
211214
id,

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,6 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphHandlerData<'a>> for NodeGrap
199199
}
200200
NodeGraphMessage::DeleteNodes { node_ids, delete_children } => {
201201
network_interface.delete_nodes(node_ids, delete_children, selection_network_path);
202-
responses.add(NodeGraphMessage::SelectedNodesUpdated);
203-
responses.add(NodeGraphMessage::SendGraph);
204202
}
205203
// Deletes selected_nodes. If `reconnect` is true, then all children nodes (secondary input) of the selected nodes are deleted and the siblings (primary input/output) are reconnected.
206204
// If `reconnect` is false, then only the selected nodes are deleted and not reconnected.
@@ -213,7 +211,10 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphHandlerData<'a>> for NodeGrap
213211
responses.add(NodeGraphMessage::DeleteNodes {
214212
node_ids: selected_nodes.selected_nodes().cloned().collect::<Vec<_>>(),
215213
delete_children,
216-
})
214+
});
215+
responses.add(NodeGraphMessage::RunDocumentGraph);
216+
responses.add(NodeGraphMessage::SelectedNodesUpdated);
217+
responses.add(NodeGraphMessage::SendGraph);
217218
}
218219
NodeGraphMessage::DisconnectInput { input_connector } => {
219220
network_interface.disconnect_input(&input_connector, selection_network_path);

editor/src/messages/tool/tool_messages/select_tool.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,9 @@ impl SelectToolData {
391391
})
392392
.collect();
393393
responses.add(NodeGraphMessage::SelectedNodesSet { nodes });
394+
responses.add(NodeGraphMessage::RunDocumentGraph);
395+
responses.add(NodeGraphMessage::SelectedNodesUpdated);
396+
responses.add(NodeGraphMessage::SendGraph);
394397
self.layers_dragging = original;
395398
}
396399
}

frontend/wasm/src/editor_api.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -622,11 +622,13 @@ impl EditorHandle {
622622
self.dispatch(message);
623623

624624
let id = NodeId(id);
625-
let message = NodeGraphMessage::DeleteNodes {
625+
self.dispatch(NodeGraphMessage::DeleteNodes {
626626
node_ids: vec![id],
627627
delete_children: true,
628-
};
629-
self.dispatch(message);
628+
});
629+
self.dispatch(NodeGraphMessage::RunDocumentGraph);
630+
self.dispatch(NodeGraphMessage::SelectedNodesUpdated);
631+
self.dispatch(NodeGraphMessage::SendGraph);
630632
}
631633

632634
/// Toggle lock state of a layer from the layer list

0 commit comments

Comments
 (0)