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
This commit is contained in:
parent
c87b7fdd8a
commit
d7b0ec9cb5
Notes:
blender-bot
2023-02-14 11:28:39 +01:00
Referenced by issue #78211, Zoom to Mouse Position is broken in Node Editor (with Trackpad, macOS)
|
@ -1233,6 +1233,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;
|
||||
}
|
||||
|
||||
|
@ -1279,14 +1284,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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue