Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-03-18 05:13:45 +0300
committerCampbell Barton <campbell@blender.org>2022-03-18 05:20:11 +0300
commit0eb394af743a2ec3e7e2704e362348997d403b15 (patch)
tree166fe7c32a389222d4bd108c281bcff6b7363758 /source/blender/editors/space_node/node_edit.cc
parent5035fbdd23ba510f19bab8dea89677e3ee314e0b (diff)
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.
Diffstat (limited to 'source/blender/editors/space_node/node_edit.cc')
-rw-r--r--source/blender/editors/space_node/node_edit.cc16
1 files changed, 6 insertions, 10 deletions
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<NodeSizeWidget>(__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;
}