diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-08-25 08:16:12 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-08-25 08:20:40 +0400 |
commit | bf5361591dd6f44f3e275615425bbe8838f976c6 (patch) | |
tree | 9ca5510d57fea3203855fae4597adb422a2982ef /source | |
parent | 1377847e7b07ed7383de22bc87df3ac6fec1acf1 (diff) |
Fix View3D glitch zooming
Fast cursor movement could clamp the distance incorrectly.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 23d47f1a5dc..41045915d0e 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -2187,10 +2187,14 @@ static void viewzoom_apply(ViewOpsData *vod, const int xy[2], const short viewzo } if (!use_cam_zoom) { - if (zfac != 1.0f && zfac * vod->rv3d->dist > 0.001f * vod->grid && - zfac * vod->rv3d->dist < 10.0f * vod->far) - { - view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy); + if (zfac != 1.0f) { + const float zfac_min = dist_range[0] / vod->rv3d->dist; + const float zfac_max = dist_range[1] / vod->rv3d->dist; + CLAMP(zfac, zfac_min, zfac_max); + + if (zfac != 1.0f) { + view_zoom_mouseloc(vod->ar, zfac, vod->oldx, vod->oldy); + } } } |