diff options
author | Yevgeny Makarov <jenkm> | 2020-10-29 18:27:48 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2020-10-29 18:27:48 +0300 |
commit | c1b30e0ed1767852c5bce6b2b132859675547cef (patch) | |
tree | 813f442169179d99dbc5a15753400edd4e640302 /source/blender/editors/interface | |
parent | 962a0a6c6614229d9e49b3b012bbee1dc9bb34b4 (diff) |
Fix for T78211: Trackpad Zoom to Mouse Position Error
When using a trackpad Zoom to Mouse Position would always zoom to center of canvas.
Differential Revision: https://developer.blender.org/D8683
Reviewed by Brecht Van Lommel
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/view2d_ops.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c index 66194cf8783..46ee437dbcf 100644 --- a/source/blender/editors/interface/view2d_ops.c +++ b/source/blender/editors/interface/view2d_ops.c @@ -1232,6 +1232,11 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even v2d = vzd->v2d; if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { + ARegion *region = CTX_wm_region(C); + + /* Store initial mouse position (in view space). */ + UI_view2d_region_to_view( + ®ion->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); vzd->zoom_to_mouse_pos = true; } @@ -1278,14 +1283,6 @@ static int view_zoomdrag_invoke(bContext *C, wmOperator *op, const wmEvent *even /* for modal exit test */ vzd->invoke_event = event->type; - if (U.uiflag & USER_ZOOM_TO_MOUSEPOS) { - ARegion *region = CTX_wm_region(C); - - /* store initial mouse position (in view space) */ - UI_view2d_region_to_view( - ®ion->v2d, event->mval[0], event->mval[1], &vzd->mx_2d, &vzd->my_2d); - } - if (v2d->keepofs & V2D_LOCKOFS_X) { WM_cursor_modal_set(window, WM_CURSOR_NS_SCROLL); } |