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:
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_edit.c')
-rw-r--r--source/blender/editors/space_view3d/view3d_edit.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c
index ff0052c1fd1..ec7c1c0b3b9 100644
--- a/source/blender/editors/space_view3d/view3d_edit.c
+++ b/source/blender/editors/space_view3d/view3d_edit.c
@@ -201,7 +201,7 @@ static void calctrackballvec(const rcti *rect, const int event_xy[2], float r_di
/* Normalize x and y. */
r_dir[0] = (event_xy[0] - BLI_rcti_cent_x(rect)) / ((size[0] * aspect[0]) / 2.0);
- r_dir[1] = (event_xy[1] - BLI_rcti_cent_x(rect)) / ((size[1] * aspect[1]) / 2.0);
+ r_dir[1] = (event_xy[1] - BLI_rcti_cent_y(rect)) / ((size[1] * aspect[1]) / 2.0);
const float d = len_v2(r_dir);
if (d < t) {
/* Inside sphere. */
@@ -1959,6 +1959,8 @@ static float viewzoom_scale_value(const rcti *winrct,
fac = (float)(xy_init[1] - xy_curr[1]);
}
+ fac /= U.pixelsize;
+
if (zoom_invert != zoom_invert_force) {
fac = -fac;
}
@@ -1974,8 +1976,8 @@ static float viewzoom_scale_value(const rcti *winrct,
BLI_rcti_cent_x(winrct),
BLI_rcti_cent_y(winrct),
};
- float len_new = 5 + len_v2v2_int(ctr, xy_curr);
- float len_old = 5 + len_v2v2_int(ctr, xy_init);
+ 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);
/* intentionally ignore 'zoom_invert' for scale */
if (zoom_invert_force) {
@@ -1985,16 +1987,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;
- float len_old = 5;
+ float len_new = 5 * U.pixelsize;
+ float len_old = 5 * U.pixelsize;
if (U.uiflag & USER_ZOOM_HORIZ) {
- len_new += (winrct->xmax - (xy_curr[0]));
- len_old += (winrct->xmax - (xy_init[0]));
+ len_new += (winrct->xmax - (xy_curr[0])) / U.pixelsize;
+ len_old += (winrct->xmax - (xy_init[0])) / U.pixelsize;
}
else {
- len_new += (winrct->ymax - (xy_curr[1]));
- len_old += (winrct->ymax - (xy_init[1]));
+ len_new += (winrct->ymax - (xy_curr[1])) / U.pixelsize;
+ len_old += (winrct->ymax - (xy_init[1])) / U.pixelsize;
}
if (zoom_invert != zoom_invert_force) {