From e4fbc383aff83aa8aa375e7ddc4df1cb5c8b1f3c Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Sun, 29 Sep 2019 06:34:02 +0300 Subject: [PATCH] Resizing photo when bubble is drawn --- Telegram/SourceFiles/history/history.style | 2 +- .../SourceFiles/history/view/media/history_view_photo.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/history.style b/Telegram/SourceFiles/history/history.style index b54bf7a81..2b5d683c8 100644 --- a/Telegram/SourceFiles/history/history.style +++ b/Telegram/SourceFiles/history/history.style @@ -373,7 +373,7 @@ botKbScroll: defaultSolidScroll; historyDateFadeDuration: 200; historyPhotoLeft: 14px; -historyPhotoCaptionedMinWidth: 200px; +historyPhotoBubbleMinWidth: 200px; historyMessageRadius: 6px; historyBubbleTailInLeft: icon {{ "bubble_tail", msgInBg }}; historyBubbleTailInLeftSelected: icon {{ "bubble_tail", msgInBgSelected }}; diff --git a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp index 15f5e968d..690c3d016 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_photo.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_photo.cpp @@ -86,7 +86,7 @@ QSize Photo::countOptimalSize() { if (_serviceWidth > 0) { return { _serviceWidth, _serviceWidth }; } - const auto minWidth = qMax((_caption.isEmpty() ? st::minPhotoSize : st::historyPhotoCaptionedMinWidth), _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); + const auto minWidth = qMax((!_parent->hasBubble() ? st::minPhotoSize : st::historyPhotoBubbleMinWidth), _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); const auto maxActualWidth = qMax(tw, minWidth); maxWidth = qMax(maxActualWidth, th); minHeight = qMax(th, st::minPhotoSize); @@ -125,7 +125,7 @@ QSize Photo::countCurrentSize(int newWidth) { if (_pixw < 1) _pixw = 1; if (_pixh < 1) _pixh = 1; - auto minWidth = qMax((_caption.isEmpty() ? st::minPhotoSize : st::historyPhotoCaptionedMinWidth), _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); + auto minWidth = qMax((!_parent->hasBubble() ? st::minPhotoSize : st::historyPhotoBubbleMinWidth), _parent->infoWidth() + 2 * (st::msgDateImgDelta + st::msgDateImgPadding.x())); newWidth = qMax(_pixw, minWidth); auto newHeight = qMax(_pixh, st::minPhotoSize); if (_parent->hasBubble() && !_caption.isEmpty()) {