[Bf-blender-cvs] [c1b30e0ed17] master: Fix for T78211: Trackpad Zoom to Mouse Position Error
Yevgeny Makarov
noreply at git.blender.org
Thu Oct 29 16:40:41 CET 2020
Commit: c1b30e0ed1767852c5bce6b2b132859675547cef
Author: Yevgeny Makarov
Date: Thu Oct 29 08:27:48 2020 -0700
Branches: master
https://developer.blender.org/rBc1b30e0ed1767852c5bce6b2b132859675547cef
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
===================================================================
M source/blender/editors/interface/view2d_ops.c
===================================================================
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);
}
More information about the Bf-blender-cvs
mailing list