Skip to content

Commit 373442f

Browse files
committed
Vertical wire path in progress
1 parent 2223a1c commit 373442f

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ pub struct NodeGraphMessageHandler {
7676
pub wire_in_progress_from_connector: Option<DVec2>,
7777
/// The end point of the dragged line (cannot be moved), stored in node graph coordinates.
7878
pub wire_in_progress_to_connector: Option<DVec2>,
79+
/// If the end point should be displayed as a vertical or horizontal connection
80+
pub to_connector_is_layer: bool,
7981
/// The data type determining the color of the wire being dragged.
8082
pub wire_in_progress_type: FrontendGraphDataType,
8183
/// State for the context menu popups.
@@ -1038,6 +1040,11 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
10381040
return;
10391041
};
10401042
self.wire_in_progress_to_connector = Some(input_position);
1043+
self.to_connector_is_layer = if let InputConnector::Node { node_id, input_index } = to_connector {
1044+
*input_index == 0 && network_interface.is_layer(node_id, selection_network_path)
1045+
} else {
1046+
false
1047+
};
10411048
}
10421049
// Not hovering over a node input or node output, update with the mouse position.
10431050
else {
@@ -1082,24 +1089,17 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
10821089
false
10831090
}
10841091
});
1085-
let to_connector_is_layer = to_connector.is_some_and(|to_connector| {
1086-
if let InputConnector::Node { node_id, input_index } = to_connector {
1087-
input_index == 0 && network_interface.is_layer(&node_id, selection_network_path)
1088-
} else {
1089-
false
1090-
}
1091-
});
10921092
let vector_wire = build_vector_wire(
10931093
wire_in_progress_from_connector,
10941094
wire_in_progress_to_connector,
10951095
from_connector_is_layer,
1096-
to_connector_is_layer,
1096+
self.to_connector_is_layer,
10971097
GraphWireStyle::Direct,
10981098
);
10991099
let wire_path = WirePathInProgress {
11001100
wire: vector_wire.to_svg(),
11011101
data_type: self.wire_in_progress_type,
1102-
thick: false,
1102+
thick: self.to_connector_is_layer && from_connector_is_layer,
11031103
};
11041104
responses.add(FrontendMessage::UpdateWirePathInProgress {
11051105
wire_path_in_progress: Some(wire_path),
@@ -2798,6 +2798,7 @@ impl Default for NodeGraphMessageHandler {
27982798
select_if_not_dragged: None,
27992799
wire_in_progress_from_connector: None,
28002800
wire_in_progress_to_connector: None,
2801+
to_connector_is_layer: false,
28012802
wire_in_progress_type: FrontendGraphDataType::General,
28022803
context_menu: None,
28032804
deselect_on_pointer_up: None,

0 commit comments

Comments
 (0)