[Bf-blender-cvs] [6978635622c] blender-v2.90-release: Fix T79787: orbit/zoom sensitivity depends on line-width

Campbell Barton noreply at git.blender.org
Tue Aug 18 04:23:56 CEST 2020


Commit: 6978635622cc77a559a3f888945d840e2e80a52d
Author: Campbell Barton
Date:   Tue Aug 18 11:23:34 2020 +1000
Branches: blender-v2.90-release
https://developer.blender.org/rB6978635622cc77a559a3f888945d840e2e80a52d

Fix T79787: orbit/zoom sensitivity depends on line-width

Use 'dpi_fac' instead of 'pixelsize' to scale input sensitivity
based on the interface scale.
Also use dpi_fac for view zoom operator.

Thanks to @ISS for investigating.

===================================================================

M	source/blender/editors/interface/view2d_ops.c
M	source/blender/editors/space_view3d/view3d_edit.c

===================================================================

diff --git a/source/blender/editors/interface/view2d_ops.c b/source/blender/editors/interface/view2d_ops.c
index 64cacd44e3d..4308310fac6 100644
--- a/source/blender/editors/interface/view2d_ops.c
+++ b/source/blender/editors/interface/view2d_ops.c
@@ -1157,8 +1157,8 @@ static void view_zoomdrag_apply(bContext *C, wmOperator *op)
   const bool zoom_to_pos = use_cursor_init && (U.uiflag & USER_ZOOM_TO_MOUSEPOS);
 
   /* get amount to move view by */
-  dx = RNA_float_get(op->ptr, "deltax") / U.pixelsize;
-  dy = RNA_float_get(op->ptr, "deltay") / U.pixelsize;
+  dx = RNA_float_get(op->ptr, "deltax") / U.dpi_fac;
+  dy = RNA_float_get(op->ptr, "deltay") / U.dpi_fac;
 
   if (U.uiflag & USER_ZOOM_INVERT) {
     dx *= -1;
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index 19aa9cb203b..7fafd9f7cd2 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -822,7 +822,7 @@ static void viewrotate_apply(ViewOpsData *vod, const int event_xy[2])
     float xaxis[3];
 
     /* Radians per-pixel. */
-    const float sensitivity = U.view_rotate_sensitivity_turntable / U.pixelsize;
+    const float sensitivity = U.view_rotate_sensitivity_turntable / U.dpi_fac;
 
     /* Get the 3x3 matrix and its inverse from the quaternion */
     quat_to_mat3(m, vod->curr.viewquat);
@@ -2038,7 +2038,7 @@ static float viewzoom_scale_value(const rcti *winrct,
       fac = (float)(xy_init[1] - xy_curr[1]);
     }
 
-    fac /= U.pixelsize;
+    fac /= U.dpi_fac;
 
     if (zoom_invert != zoom_invert_force) {
       fac = -fac;
@@ -2055,8 +2055,8 @@ static float viewzoom_scale_value(const rcti *winrct,
         BLI_rcti_cent_x(winrct),
         BLI_rcti_cent_y(winrct),
     };
-    float len_new = (5 * U.pixelsize) + ((float)len_v2v2_int(ctr, xy_curr) / U.pixelsize);
-    float len_old = (5 * U.pixelsize) + ((float)len_v2v2_int(ctr, xy_init) / U.pixelsize);
+    float len_new = (5 * U.dpi_fac) + ((float)len_v2v2_int(ctr, xy_curr) / U.dpi_fac);
+    float len_old = (5 * U.dpi_fac) + ((float)len_v2v2_int(ctr, xy_init) / U.dpi_fac);
 
     /* intentionally ignore 'zoom_invert' for scale */
     if (zoom_invert_force) {
@@ -2066,16 +2066,16 @@ static float viewzoom_scale_value(const rcti *winrct,
     zfac = val_orig * (len_old / max_ff(len_new, 1.0f)) / val;
   }
   else { /* USER_ZOOM_DOLLY */
-    float len_new = 5 * U.pixelsize;
-    float len_old = 5 * U.pixelsize;
+    float len_new = 5 * U.dpi_fac;
+    float len_old = 5 * U.dpi_fac;
 
     if (U.uiflag & USER_ZOOM_HORIZ) {
-      len_new += (winrct->xmax - (xy_curr[0])) / U.pixelsize;
-      len_old += (winrct->xmax - (xy_init[0])) / U.pixelsize;
+      len_new += (winrct->xmax - (xy_curr[0])) / U.dpi_fac;
+      len_old += (winrct->xmax - (xy_init[0])) / U.dpi_fac;
     }
     else {
-      len_new += (winrct->ymax - (xy_curr[1])) / U.pixelsize;
-      len_old += (winrct->ymax - (xy_init[1])) / U.pixelsize;
+      len_new += (winrct->ymax - (xy_curr[1])) / U.dpi_fac;
+      len_old += (winrct->ymax - (xy_init[1])) / U.dpi_fac;
     }
 
     if (zoom_invert != zoom_invert_force) {



More information about the Bf-blender-cvs mailing list