mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-26 06:28:11 +08:00
Fix node shaking causing an offset from the pointer for the rest of the drag (#4411)
This commit is contained in:
@@ -1509,7 +1509,7 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NodeGraphMessage::ShakeNode => {
|
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");
|
log::error!("Drag start should be initialized when shaking a node");
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@@ -1527,7 +1527,11 @@ impl<'a> MessageHandler<NodeGraphMessage, NodeGraphMessageContext<'a>> for NodeG
|
|||||||
.transform_point2(viewport_location);
|
.transform_point2(viewport_location);
|
||||||
|
|
||||||
// Collect the distance to move the shaken nodes after the undo
|
// 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
|
// Undo to the state of the graph before shaking
|
||||||
responses.add(DocumentMessage::AbortTransaction);
|
responses.add(DocumentMessage::AbortTransaction);
|
||||||
|
|||||||
Reference in New Issue
Block a user