mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 22:28:10 +08:00
Add drag to connect nodes (#901)
* Add drag to connect nodes * Clean up node graph code * Close node list with escape or click * Check if line is contained within box * Shift the nodes Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
committed by
Keavon Chambers
parent
49b9b8cfec
commit
8f4f7b3cf1
@@ -180,6 +180,19 @@ impl NodeNetwork {
|
||||
.collect();
|
||||
}
|
||||
|
||||
/// Collect a hashmap of nodes with a list of the nodes that use it as input
|
||||
pub fn collect_outwards_links(&self) -> HashMap<NodeId, Vec<NodeId>> {
|
||||
let mut outwards_links: HashMap<u64, Vec<u64>> = HashMap::new();
|
||||
for (node_id, node) in &self.nodes {
|
||||
for input in &node.inputs {
|
||||
if let NodeInput::Node(ref_id) = input {
|
||||
outwards_links.entry(*ref_id).or_default().push(*node_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
outwards_links
|
||||
}
|
||||
|
||||
pub fn flatten(&mut self, node: NodeId) {
|
||||
self.flatten_with_fns(node, merge_ids, generate_uuid)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user