Skip to content

Commit 44446e4

Browse files
committed
Vertical wire path in progress
1 parent 075e5d6 commit 44446e4

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

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
@@ -79,6 +79,8 @@ pub struct NodeGraphMessageHandler {
7979
pub wire_in_progress_from_connector: Option<DVec2>,
8080
/// The end point of the dragged line (cannot be moved), stored in node graph coordinates.
8181
pub wire_in_progress_to_connector: Option<DVec2>,
82+
/// If the end point should be displayed as a vertical or horizontal connection
83+
pub to_connector_is_layer: bool,
8284
/// The data type determining the color of the wire being dragged.
8385
pub wire_in_progress_type: FrontendGraphDataType,
8486
/// State for the context menu popups.
@@ -1037,6 +1039,11 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
10371039
return;
10381040
};
10391041
self.wire_in_progress_to_connector = Some(input_position);
1042+
self.to_connector_is_layer = if let InputConnector::Node { node_id, input_index } = to_connector {
1043+
*input_index == 0 && network_interface.is_layer(node_id, selection_network_path)
1044+
} else {
1045+
false
1046+
};
10401047
}
10411048
// Not hovering over a node input or node output, update with the mouse position.
10421049
else {
@@ -1081,24 +1088,17 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
10811088
false
10821089
}
10831090
});
1084-
let to_connector_is_layer = to_connector.is_some_and(|to_connector| {
1085-
if let InputConnector::Node { node_id, input_index } = to_connector {
1086-
input_index == 0 && network_interface.is_layer(&node_id, selection_network_path)
1087-
} else {
1088-
false
1089-
}
1090-
});
10911091
let vector_wire = build_vector_wire(
10921092
wire_in_progress_from_connector,
10931093
wire_in_progress_to_connector,
10941094
from_connector_is_layer,
1095-
to_connector_is_layer,
1095+
self.to_connector_is_layer,
10961096
GraphWireStyle::Direct,
10971097
);
10981098
let wire_path = WirePathInProgress {
10991099
wire: vector_wire.to_svg(),
11001100
data_type: self.wire_in_progress_type,
1101-
thick: false,
1101+
thick: self.to_connector_is_layer && from_connector_is_layer,
11021102
};
11031103
responses.add(FrontendMessage::UpdateWirePathInProgress {
11041104
wire_path_in_progress: Some(wire_path),
@@ -2799,6 +2799,7 @@ impl Default for NodeGraphMessageHandler {
27992799
select_if_not_dragged: None,
28002800
wire_in_progress_from_connector: None,
28012801
wire_in_progress_to_connector: None,
2802+
to_connector_is_layer: false,
28022803
wire_in_progress_type: FrontendGraphDataType::General,
28032804
context_menu: None,
28042805
deselect_on_pointer_up: None,

0 commit comments

Comments
 (0)