Fixed preview display of small media in SendFilesBox.

This commit is contained in:
23rd 2020-11-05 17:21:52 +03:00 committed by John Preston
parent fad7996e63
commit 42d4fdb89f
1 changed files with 7 additions and 0 deletions

View File

@ -126,11 +126,18 @@ void SingleMediaPreview::preparePreview(
_previewWidth = qMax(preview.width(), kMinPreviewWidth);
}
auto maxthumbh = qMin(qRound(1.5 * _previewWidth), st::confirmMaxHeight);
const auto minthumbh = st::sendBoxAlbumGroupHeight
+ st::sendBoxAlbumGroupSkipTop * 2;
_previewHeight = qRound(originalHeight * float64(_previewWidth) / originalWidth);
if (_previewHeight > maxthumbh) {
_previewWidth = qRound(_previewWidth * float64(maxthumbh) / _previewHeight);
accumulate_max(_previewWidth, kMinPreviewWidth);
_previewHeight = maxthumbh;
} else if (_previewHeight < minthumbh) {
_previewWidth = qRound(_previewWidth * float64(minthumbh)
/ _previewHeight);
accumulate_max(_previewWidth, kMinPreviewWidth);
_previewHeight = minthumbh;
}
_previewLeft = (st::boxWideWidth - _previewWidth) / 2;