Improve reply info layout in narrow mode.

Fixes #24935.
This commit is contained in:
John Preston 2022-08-15 16:21:08 +03:00
parent 2c0a38d356
commit 24ee944689
1 changed files with 6 additions and 3 deletions

View File

@ -99,7 +99,7 @@ QSize UnwrappedMedia::countCurrentSize(int newWidth) {
_additionalOnTop = (optimalw + paddings + additionalMinWidth) > newWidth;
const auto surrounding = surroundingInfo(via, reply, forwarded, additional - st::msgReplyPadding.left());
if (_additionalOnTop) {
_topAdded = surrounding.height;
_topAdded = surrounding.height + st::msgMargin.bottom();
newHeight += _topAdded;
} else {
const auto infoHeight = st::msgDateImgPadding.y() * 2
@ -143,7 +143,10 @@ void UnwrappedMedia::draw(Painter &p, const PaintContext &context) const {
const auto useh = rightAligned
? std::max(
_contentSize.height(),
height() - st::msgDateImgPadding.y() * 2 - st::msgDateFont->height)
(height()
- _topAdded
- st::msgDateImgPadding.y() * 2
- st::msgDateFont->height))
: _contentSize.height();
const auto inner = QRect(usex, usey, usew, useh);
if (context.skipDrawingParts != PaintContext::SkipDrawingParts::Content) {
@ -218,7 +221,7 @@ void UnwrappedMedia::drawSurrounding(
if (const auto surrounding = surroundingInfo(via, reply, forwarded, rectw)) {
auto recth = surrounding.height;
int rectx = _additionalOnTop
? (rightAligned ? (inner.width() + st::msgReplyPadding.left() - rectw) : 0)
? (rightAligned ? (inner.x() + inner.width() - rectw) : 0)
: (rightAligned ? 0 : (inner.width() + st::msgReplyPadding.left()));
int recty = 0;
if (rtl()) rectx = width() - rectx - rectw;