Fix bot about title display.

This commit is contained in:
John Preston 2024-06-02 10:55:09 +04:00
parent 47e06cf385
commit 1656a9c3e2
3 changed files with 5 additions and 51 deletions

View File

@ -1012,10 +1012,10 @@ QSize Message::performCountOptimalSize() {
accumulate_max(maxWidth, entry->maxWidth());
minHeight += entry->minHeight();
}
if (withVisibleText && botTop) {
accumulate_max(maxWidth, botTop->maxWidth);
minHeight += botTop->height;
}
}
if (withVisibleText && botTop) {
accumulate_max(maxWidth, botTop->maxWidth);
minHeight += botTop->height;
}
accumulate_max(maxWidth, minWidthForMedia());
} else if (media) {

View File

@ -265,10 +265,6 @@ QSize Gif::countOptimalSize() {
minHeight = adjustHeightForLessCrop(
scaled,
{ maxWidth, minHeight });
if (const auto botTop = _parent->Get<FakeBotAboutTop>()) {
accumulate_max(maxWidth, botTop->maxWidth);
minHeight += botTop->height;
}
} else if (isUnwrapped()) {
const auto item = _parent->data();
auto via = item->Get<HistoryMessageVia>();
@ -310,9 +306,6 @@ QSize Gif::countCurrentSize(int newWidth) {
newHeight = adjustHeightForLessCrop(
scaled,
{ newWidth, newHeight });
if (botTop) {
newHeight += botTop->height;
}
} else if (isUnwrapped()) {
accumulate_max(newWidth, _parent->reactionsOptimalWidth());
@ -408,16 +401,10 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
const auto rightLayout = _parent->hasRightLayout();
const auto inWebPage = (_parent->media() != this);
const auto isRound = _data->isVideoMessage();
const auto botTop = _parent->Get<FakeBotAboutTop>();
const auto rounding = inWebPage
? std::optional<Ui::BubbleRounding>()
: adjustedBubbleRounding();
if (bubble) {
if (botTop) {
painth -= botTop->height;
}
}
auto usex = 0, usew = paintw;
const auto unwrapped = isUnwrapped();
@ -756,22 +743,7 @@ void Gif::draw(Painter &p, const PaintContext &context) const {
}
}
}
if (!unwrapped && bubble && !isBubbleBottom()) {
p.setPen(stm->historyTextFg);
auto top = painty + painth + st::mediaCaptionSkip;
if (botTop) {
auto captionw = paintw
- st::msgPadding.left()
- st::msgPadding.right();
botTop->text.drawLeftElided(
p,
st::msgPadding.left(),
top,
captionw,
_parent->width());
top += botTop->height;
}
} else if (!inWebPage && !skipDrawingSurrounding) {
if (!inWebPage && !skipDrawingSurrounding) {
auto fullRight = paintx + usex + usew;
auto fullBottom = painty + painth;
auto maxRight = _parent->width() - st::msgMargin.left();
@ -1032,11 +1004,6 @@ TextState Gif::textState(QPoint point, StateRequest request) const {
auto paintx = 0, painty = 0, paintw = width(), painth = height();
auto bubble = _parent->hasBubble();
if (bubble) {
if (const auto botTop = _parent->Get<FakeBotAboutTop>()) {
painth -= botTop->height;
}
}
const auto rightLayout = _parent->hasRightLayout();
const auto inWebPage = (_parent->media() != this);
const auto isRound = _data->isVideoMessage();

View File

@ -196,10 +196,6 @@ QSize Photo::countOptimalSize() {
minHeight = adjustHeightForLessCrop(
dimensions,
{ maxWidth, minHeight });
if (const auto botTop = _parent->Get<FakeBotAboutTop>()) {
accumulate_max(maxWidth, botTop->maxWidth);
minHeight += botTop->height;
}
}
return { maxWidth, minHeight };
}
@ -234,9 +230,6 @@ QSize Photo::countCurrentSize(int newWidth) {
imageHeight = newHeight = adjustHeightForLessCrop(
dimensions,
{ newWidth, newHeight });
if (botTop) {
newHeight += botTop->height;
}
}
const auto enlargeInner = st::historyPageEnlargeSize;
const auto enlargeOuter = 2 * st::historyPageEnlargeSkip + enlargeInner;
@ -609,12 +602,6 @@ TextState Photo::textState(QPoint point, StateRequest request) const {
auto paintx = 0, painty = 0, paintw = width(), painth = height();
auto bubble = _parent->hasBubble();
if (bubble) {
if (const auto botTop = _parent->Get<FakeBotAboutTop>()) {
painth -= botTop->height;
}
painth -= st::mediaCaptionSkip;
}
if (QRect(paintx, painty, paintw, painth).contains(point)) {
ensureDataMediaCreated();
result.link = (_spoiler && !_spoiler->revealed)