From 0eb394af743a2ec3e7e2704e362348997d403b15 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 18 Mar 2022 13:13:45 +1100 Subject: Fix resizing nodes not respecting the drag-start Resizing nodes used the cursor location when the event was triggered instead of the drag-start, harmless but means the drag location isn't under the cursor especially with a high drag threshold. Noticed when investigating other drag issues, unrelated to recent changes to drag behavior. --- source/blender/editors/space_node/node_edit.cc | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc index 1ca2f877398..1c278de28d0 100644 --- a/source/blender/editors/space_node/node_edit.cc +++ b/source/blender/editors/space_node/node_edit.cc @@ -897,19 +897,15 @@ struct NodeSizeWidget { int directions; }; -static void node_resize_init(bContext *C, - wmOperator *op, - const wmEvent *UNUSED(event), - const bNode *node, - NodeResizeDirection dir) +static void node_resize_init( + bContext *C, wmOperator *op, const float cursor[2], const bNode *node, NodeResizeDirection dir) { - SpaceNode *snode = CTX_wm_space_node(C); - NodeSizeWidget *nsw = MEM_cnew(__func__); op->customdata = nsw; - nsw->mxstart = snode->runtime->cursor[0] * UI_DPI_FAC; - nsw->mystart = snode->runtime->cursor[1] * UI_DPI_FAC; + + nsw->mxstart = cursor[0]; + nsw->mystart = cursor[1]; /* store old */ nsw->oldlocx = node->locx; @@ -1068,7 +1064,7 @@ static int node_resize_invoke(bContext *C, wmOperator *op, const wmEvent *event) return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH; } - node_resize_init(C, op, event, node, dir); + node_resize_init(C, op, cursor, node, dir); return OPERATOR_RUNNING_MODAL; } -- cgit v1.2.3