From f42787ec1f953a6eadb5db9680f21a66174b2a5d Mon Sep 17 00:00:00 2001 From: Keavon Chambers Date: Sun, 2 Aug 2026 23:32:52 -0700 Subject: [PATCH] Fix node shaking causing an offset from the pointer for the rest of the drag --- .../document/node_graph/node_graph_message_handler.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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 4b97b61316..7efd6efa72 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 @@ -1509,7 +1509,7 @@ impl<'a> MessageHandler> for NodeG } } NodeGraphMessage::ShakeNode => { - let Some(drag_start) = &self.drag_start else { + let Some((drag_start, _)) = &mut self.drag_start else { log::error!("Drag start should be initialized when shaking a node"); return; }; @@ -1527,7 +1527,11 @@ impl<'a> MessageHandler> for NodeG .transform_point2(viewport_location); // Collect the distance to move the shaken nodes after the undo - let graph_delta = IVec2::new(((point.x - drag_start.0.start_x) / 24.).round() as i32, ((point.y - drag_start.0.start_y) / 24.).round() as i32); + let graph_delta = IVec2::new(((point.x - drag_start.start_x) / 24.).round() as i32, ((point.y - drag_start.start_y) / 24.).round() as i32); + + // Keep the incremental rounding baseline in sync with the total shift reapplied below + drag_start.round_x = graph_delta.x; + drag_start.round_y = graph_delta.y; // Undo to the state of the graph before shaking responses.add(DocumentMessage::AbortTransaction);