Skip to content

Commit

Permalink
Fix file albums with inline keyboard buttons.
Browse files Browse the repository at this point in the history
  • Loading branch information
john-preston committed Sep 5, 2024
1 parent 6c5036e commit 216865a
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions Telegram/SourceFiles/history/view/history_view_message.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1142,6 +1142,15 @@ void Message::draw(Painter &p, const PaintContext &context) const {
const auto displayInfo = needInfoDisplay();
const auto reactionsInBubble = _reactions && embedReactionsInBubble();

const auto keyboard = item->inlineReplyKeyboard();
const auto fullGeometry = g;
if (keyboard) {
// We need to count geometry without keyboard for bubble selection
// intervals counting below.
const auto keyboardHeight = st::msgBotKbButton.margin + keyboard->naturalHeight();
g.setHeight(g.height() - keyboardHeight);
}

auto mediaSelectionIntervals = (!context.selected() && mediaDisplayed)
? media->getBubbleSelectionIntervals(context.selection)
: std::vector<Ui::BubbleSelectionInterval>();
Expand Down Expand Up @@ -1176,25 +1185,22 @@ void Message::draw(Painter &p, const PaintContext &context) const {
if (customHighlight) {
media->drawHighlight(p, context, localMediaTop);
} else {
paintHighlight(p, context, g.height());
paintHighlight(p, context, fullGeometry.height());
}

const auto roll = media ? media->bubbleRoll() : Media::BubbleRoll();
if (roll) {
p.save();
p.translate(g.center());
p.translate(fullGeometry.center());
p.rotate(roll.rotate);
p.scale(roll.scale, roll.scale);
p.translate(-g.center());
p.translate(-fullGeometry.center());
}

p.setTextPalette(stm->textPalette);

const auto keyboard = item->inlineReplyKeyboard();
const auto messageRounding = countMessageRounding();
if (keyboard) {
const auto keyboardHeight = st::msgBotKbButton.margin + keyboard->naturalHeight();
g.setHeight(g.height() - keyboardHeight);
const auto keyboardPosition = QPoint(g.left(), g.top() + g.height() + st::msgBotKbButton.margin);
p.translate(keyboardPosition);
keyboard->paint(
Expand Down

0 comments on commit 216865a

Please sign in to comment.