Merge branch 'blender-v2.91-release'

This commit is contained in:
Campbell Barton 2020-10-27 14:13:39 +11:00
commit 6133159311
1 changed files with 14 additions and 0 deletions

View File

@ -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;
}