mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-16 06:38:03 +08:00
Drag out links to disconnect nodes (#894)
* Disconnecting Links * Fix bug if nodeid is 0
This commit is contained in:
committed by
Keavon Chambers
parent
4f637ee18b
commit
5e95090504
@@ -25,6 +25,10 @@ pub enum NodeGraphMessage {
|
||||
node_id: NodeId,
|
||||
},
|
||||
DeleteSelectedNodes,
|
||||
DisconnectNodes {
|
||||
node_id: NodeId,
|
||||
input_index: usize,
|
||||
},
|
||||
DoubleClickNode {
|
||||
node: NodeId,
|
||||
},
|
||||
|
||||
@@ -392,6 +392,22 @@ impl MessageHandler<NodeGraphMessage, (&mut Document, &InputPreprocessorMessageH
|
||||
}
|
||||
}
|
||||
}
|
||||
NodeGraphMessage::DisconnectNodes { node_id, input_index } => {
|
||||
let Some(network) = self.get_active_network_mut(document) else {
|
||||
warn!("No network");
|
||||
return;
|
||||
};
|
||||
let Some(node) = network.nodes.get_mut(&node_id) else {
|
||||
warn!("Invalid node");
|
||||
return;
|
||||
};
|
||||
let Some(node_type) = resolve_document_node_type(&node.name) else {
|
||||
warn!("Node {} not in library", node.name);
|
||||
return;
|
||||
};
|
||||
node.inputs[input_index] = node_type.inputs[input_index].default.clone();
|
||||
Self::send_graph(network, responses);
|
||||
}
|
||||
NodeGraphMessage::DoubleClickNode { node } => {
|
||||
self.selected_nodes = Vec::new();
|
||||
if let Some(network) = self.get_active_network_mut(document) {
|
||||
|
||||
Reference in New Issue
Block a user