diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-10-27 06:13:39 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-10-27 06:13:39 +0300 |
commit | 6133159311a0c7aea20c755dbd7f7bffe1027095 (patch) | |
tree | 36b91ba754305920545072178d0ab3397f1f4434 /source/blender | |
parent | 5e8c1355403bd83f0d1cf5705f825adb1ccf47d8 (diff) | |
parent | 77a6b6fb1ac0a1973398790a245a013a9e1a684b (diff) |
Merge branch 'blender-v2.91-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_edit.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/editors/space_view3d/view3d_edit.c b/source/blender/editors/space_view3d/view3d_edit.c index 233967fa89d..83a2254e811 100644 --- a/source/blender/editors/space_view3d/view3d_edit.c +++ b/source/blender/editors/space_view3d/view3d_edit.c @@ -3635,6 +3635,17 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) MEM_SAFE_FREE(depth_temp.depths); } + /* Resize border to the same ratio as the window. */ + { + const float region_aspect = (float)region->winx / (float)region->winy; + if (((float)BLI_rcti_size_x(&rect) / (float)BLI_rcti_size_y(&rect)) < region_aspect) { + BLI_rcti_resize_x(&rect, (int)(BLI_rcti_size_y(&rect) * region_aspect)); + } + else { + BLI_rcti_resize_y(&rect, (int)(BLI_rcti_size_x(&rect) / region_aspect)); + } + } + cent[0] = (((float)rect.xmin) + ((float)rect.xmax)) / 2; cent[1] = (((float)rect.ymin) + ((float)rect.ymax)) / 2; @@ -3657,6 +3668,9 @@ static int view3d_zoom_border_exec(bContext *C, wmOperator *op) new_dist = len_v3(dvec); + /* Account for the lens, without this a narrow lens zooms in too close. */ + new_dist *= (v3d->lens / DEFAULT_SENSOR_WIDTH); + /* ignore dist_range min */ dist_range[0] = v3d->clip_start * 1.5f; } |