Skip to content

Commit ee6a842

Browse files
authored
Fix dragging a node onto a secondary input's wire not working (#2583)
Fix dragging onto wire
1 parent a94354d commit ee6a842

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,6 +1155,28 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphHandlerData<'a>> for NodeGrap
11551155

11561156
!bezier.rectangle_intersections(bounding_box[0], bounding_box[1]).is_empty() || bezier.is_contained_within(bounding_box[0], bounding_box[1])
11571157
})
1158+
.collect::<Vec<_>>()
1159+
.into_iter()
1160+
.filter_map(|mut wire| {
1161+
if let Some(end_node_id) = wire.wire_end.node_id() {
1162+
let Some(actual_index_from_exposed) = (0..network_interface.number_of_inputs(&end_node_id, selection_network_path))
1163+
.filter(|&input_index| {
1164+
network_interface
1165+
.input_from_connector(&InputConnector::Node { node_id: end_node_id, input_index }, selection_network_path)
1166+
.is_some_and(|input| input.is_exposed_to_frontend(selection_network_path.is_empty()))
1167+
})
1168+
.nth(wire.wire_end.input_index())
1169+
else {
1170+
log::error!("Could not get exposed input index for {:?}", wire.wire_end);
1171+
return None;
1172+
};
1173+
wire.wire_end = InputConnector::Node {
1174+
node_id: end_node_id,
1175+
input_index: actual_index_from_exposed,
1176+
};
1177+
}
1178+
Some(wire)
1179+
})
11581180
.collect::<Vec<_>>();
11591181

11601182
let is_stack_wire = |wire: &FrontendNodeWire| match (wire.wire_start.node_id(), wire.wire_end.node_id(), wire.wire_end.input_index()) {

0 commit comments

Comments
 (0)