diff --git a/editor/src/messages/portfolio/document/document_message_handler.rs b/editor/src/messages/portfolio/document/document_message_handler.rs index 85fb01c76a..5ae92d026a 100644 --- a/editor/src/messages/portfolio/document/document_message_handler.rs +++ b/editor/src/messages/portfolio/document/document_message_handler.rs @@ -12,6 +12,7 @@ use crate::messages::layout::utility_types::widget_prelude::*; use crate::messages::portfolio::document::data_panel::{DataPanelMessageContext, DataPanelMessageHandler}; use crate::messages::portfolio::document::graph_operation::utility_types::TransformIn; use crate::messages::portfolio::document::node_graph::NodeGraphMessageContext; +use crate::messages::portfolio::document::node_graph::utility_types::FrontendGraphDataType; use crate::messages::portfolio::document::overlays::grid_overlays::{grid_overlay, overlay_options}; use crate::messages::portfolio::document::overlays::utility_types::{OverlaysType, OverlaysVisibilitySettings}; use crate::messages::portfolio::document::properties_panel::properties_panel_message_handler::PropertiesPanelMessageContext; @@ -479,6 +480,20 @@ impl MessageHandler> for DocumentMes if self.node_graph_handler.drag_start.is_some() { responses.add(DocumentMessage::AbortTransaction); self.node_graph_handler.drag_start = None; + } + // Abort box selection + else if self.node_graph_handler.box_selection_start.is_some() { + self.node_graph_handler.box_selection_start = None; + responses.add(NodeGraphMessage::SelectedNodesSet { + nodes: self.node_graph_handler.selection_before_pointer_down.clone(), + }); + responses.add(FrontendMessage::UpdateBox { box_selection: None }); + } else if self.node_graph_handler.wire_in_progress_from_connector.is_some() { + self.node_graph_handler.wire_in_progress_from_connector = None; + self.node_graph_handler.wire_in_progress_type = FrontendGraphDataType::General; + self.node_graph_handler.wire_in_progress_to_connector = None; + responses.add(DocumentMessage::AbortTransaction); + responses.add(FrontendMessage::UpdateWirePathInProgress { wire_path: None }); } else if self .node_graph_handler .context_menu diff --git a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs index a52fbd0765..ea944f9421 100644 --- a/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs +++ b/editor/src/messages/portfolio/document/node_graph/node_graph_message_handler.rs @@ -63,9 +63,9 @@ pub struct NodeGraphMessageHandler { pub drag_start_chain_nodes: Vec, /// If dragging the background to create a box selection, this stores its starting point in node graph coordinates, /// plus a flag indicating if it has been dragged since the mousedown began. - box_selection_start: Option<(DVec2, bool)>, + pub box_selection_start: Option<(DVec2, bool)>, /// Restore the selection before box selection if it is aborted - selection_before_pointer_down: Vec, + pub selection_before_pointer_down: Vec, /// If the grip icon is held during a drag, then shift without pushing other nodes shift_without_push: bool, disconnecting: Option, @@ -74,7 +74,7 @@ pub struct NodeGraphMessageHandler { select_if_not_dragged: Option, /// The start of the dragged line (cannot be moved), stored in node graph coordinates pub wire_in_progress_from_connector: Option, - wire_in_progress_type: FrontendGraphDataType, + pub wire_in_progress_type: FrontendGraphDataType, /// The end point of the dragged line (cannot be moved), stored in node graph coordinates pub wire_in_progress_to_connector: Option, /// State for the context menu popups.