Vertical wire path in progress

This commit is contained in:
Adam
2026-01-15 23:41:56 -08:00
parent 075e5d67ae
commit 44446e4ea5
@@ -79,6 +79,8 @@ pub struct NodeGraphMessageHandler {
pub wire_in_progress_from_connector: Option<DVec2>, pub wire_in_progress_from_connector: Option<DVec2>,
/// The end point of the dragged line (cannot be moved), stored in node graph coordinates. /// The end point of the dragged line (cannot be moved), stored in node graph coordinates.
pub wire_in_progress_to_connector: Option<DVec2>, pub wire_in_progress_to_connector: Option<DVec2>,
/// If the end point should be displayed as a vertical or horizontal connection
pub to_connector_is_layer: bool,
/// The data type determining the color of the wire being dragged. /// The data type determining the color of the wire being dragged.
pub wire_in_progress_type: FrontendGraphDataType, pub wire_in_progress_type: FrontendGraphDataType,
/// State for the context menu popups. /// State for the context menu popups.
@@ -1037,6 +1039,11 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
return; return;
}; };
self.wire_in_progress_to_connector = Some(input_position); self.wire_in_progress_to_connector = Some(input_position);
self.to_connector_is_layer = if let InputConnector::Node { node_id, input_index } = to_connector {
*input_index == 0 && network_interface.is_layer(node_id, selection_network_path)
} else {
false
};
} }
// Not hovering over a node input or node output, update with the mouse position. // Not hovering over a node input or node output, update with the mouse position.
else { else {
@@ -1081,24 +1088,17 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
false false
} }
}); });
let to_connector_is_layer = to_connector.is_some_and(|to_connector| {
if let InputConnector::Node { node_id, input_index } = to_connector {
input_index == 0 && network_interface.is_layer(&node_id, selection_network_path)
} else {
false
}
});
let vector_wire = build_vector_wire( let vector_wire = build_vector_wire(
wire_in_progress_from_connector, wire_in_progress_from_connector,
wire_in_progress_to_connector, wire_in_progress_to_connector,
from_connector_is_layer, from_connector_is_layer,
to_connector_is_layer, self.to_connector_is_layer,
GraphWireStyle::Direct, GraphWireStyle::Direct,
); );
let wire_path = WirePathInProgress { let wire_path = WirePathInProgress {
wire: vector_wire.to_svg(), wire: vector_wire.to_svg(),
data_type: self.wire_in_progress_type, data_type: self.wire_in_progress_type,
thick: false, thick: self.to_connector_is_layer && from_connector_is_layer,
}; };
responses.add(FrontendMessage::UpdateWirePathInProgress { responses.add(FrontendMessage::UpdateWirePathInProgress {
wire_path_in_progress: Some(wire_path), wire_path_in_progress: Some(wire_path),
@@ -2799,6 +2799,7 @@ impl Default for NodeGraphMessageHandler {
select_if_not_dragged: None, select_if_not_dragged: None,
wire_in_progress_from_connector: None, wire_in_progress_from_connector: None,
wire_in_progress_to_connector: None, wire_in_progress_to_connector: None,
to_connector_is_layer: false,
wire_in_progress_type: FrontendGraphDataType::General, wire_in_progress_type: FrontendGraphDataType::General,
context_menu: None, context_menu: None,
deselect_on_pointer_up: None, deselect_on_pointer_up: None,