Skip to content

Commit da51885

Browse files
Fix selection jumping back to previously selected node after its drag abort, upon clicking to select a new node (#3696)
* fix : Selection jumps back to previously selected node after its drag abort, upon clicking to select new node * fix : Selection jumps back to previously selected node after its drag abort via esc key, upon clicking to select new node
1 parent 3900048 commit da51885

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

editor/src/messages/portfolio/document/document_message_handler.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,7 @@ impl MessageHandler<DocumentMessage, DocumentMessageContext<'_>> for DocumentMes
480480
if self.node_graph_handler.drag_start.is_some() {
481481
responses.add(DocumentMessage::AbortTransaction);
482482
self.node_graph_handler.drag_start = None;
483+
self.node_graph_handler.select_if_not_dragged = None;
483484
}
484485
// Abort box selection
485486
else if self.node_graph_handler.box_selection_start.is_some() {

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub struct NodeGraphMessageHandler {
7474
disconnecting: Option<InputConnector>,
7575
initial_disconnecting: bool,
7676
/// Node to select on pointer up if multiple nodes are selected and they were not dragged.
77-
select_if_not_dragged: Option<NodeId>,
77+
pub select_if_not_dragged: Option<NodeId>,
7878
/// The start of the dragged line (cannot be moved), stored in node graph coordinates.
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.
@@ -778,6 +778,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
778778
// Abort dragging a node
779779
if self.drag_start.is_some() {
780780
self.drag_start = None;
781+
self.select_if_not_dragged = None;
781782
responses.add(DocumentMessage::AbortTransaction);
782783
responses.add(NodeGraphMessage::SelectedNodesSet {
783784
nodes: self.selection_before_pointer_down.clone(),

0 commit comments

Comments
 (0)