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-09 00:36:36 +0300
committerCampbell Barton <campbell@blender.org>2022-03-09 00:38:42 +0300
commitb8960267dd51f9108b3b49e9b762e6b4d35ae1dc (patch)
tree910b39958345ed78ebb8607e4d15341d88cd6359 /source/blender/editors/space_node/node_edit.cc
parent156e07232e79d53fa3f43d4bcfc4b0c4061331e5 (diff)
Event System: drag events no longer default to the drag start location
This avoids transform jumping which is a problem when tweaking values a small amount. A fix for T40549 was made box-select used the location when the key was pressed. While it's important for box-select or any operator where it's expected the drag-start location is used, this is only needed in some cases. Since the event stores the click location and the current location, no longer overwrite the events real location. Operators that depend on using the drag-start can use this location if they need. In some cases the region relative cursor location (Event.mval) now needs to be calculated based on the click location. - Added `WM_event_drag_start_mval` for convenient access to the region relative drag-start location (for drag events). - Added `WM_event_drag_start_xy` for window relative coordinates. - Added Python property Event.mouse_prev_click_x/y Resolves T93599. Reviewed By: Severin Ref D14213
Diffstat (limited to 'source/blender/editors/space_node/node_edit.cc')
-rw-r--r--source/blender/editors/space_node/node_edit.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/source/blender/editors/space_node/node_edit.cc b/source/blender/editors/space_node/node_edit.cc
index b30be6ae0af..ab1f509af47 100644
--- a/source/blender/editors/space_node/node_edit.cc
+++ b/source/blender/editors/space_node/node_edit.cc
@@ -955,8 +955,10 @@ static int node_resize_modal(bContext *C, wmOperator *op, const wmEvent *event)
switch (event->type) {
case MOUSEMOVE: {
+ int mval[2];
+ WM_event_drag_start_mval(event, region, mval);
float mx, my;
- UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &mx, &my);
+ UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &mx, &my);
float dx = (mx - nsw->mxstart) / UI_DPI_FAC;
float dy = (my - nsw->mystart) / UI_DPI_FAC;
@@ -1057,7 +1059,9 @@ static int node_resize_invoke(bContext *C, wmOperator *op, const wmEvent *event)
/* convert mouse coordinates to v2d space */
float cursor[2];
- UI_view2d_region_to_view(&region->v2d, event->mval[0], event->mval[1], &cursor[0], &cursor[1]);
+ int mval[2];
+ WM_event_drag_start_mval(event, region, mval);
+ UI_view2d_region_to_view(&region->v2d, mval[0], mval[1], &cursor[0], &cursor[1]);
const NodeResizeDirection dir = node_get_resize_direction(node, cursor[0], cursor[1]);
if (dir == NODE_RESIZE_NONE) {
return OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH;