Fix file albums with inline keyboard buttons.

This commit is contained in:
John Preston 2024-09-05 12:01:43 +04:00
parent 6c5036ee8d
commit 216865a20d
1 changed files with 12 additions and 6 deletions

View File

@ -1142,6 +1142,15 @@ void Message::draw(Painter &p, const PaintContext &context) const {
const auto displayInfo = needInfoDisplay(); const auto displayInfo = needInfoDisplay();
const auto reactionsInBubble = _reactions && embedReactionsInBubble(); 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) auto mediaSelectionIntervals = (!context.selected() && mediaDisplayed)
? media->getBubbleSelectionIntervals(context.selection) ? media->getBubbleSelectionIntervals(context.selection)
: std::vector<Ui::BubbleSelectionInterval>(); : std::vector<Ui::BubbleSelectionInterval>();
@ -1176,25 +1185,22 @@ void Message::draw(Painter &p, const PaintContext &context) const {
if (customHighlight) { if (customHighlight) {
media->drawHighlight(p, context, localMediaTop); media->drawHighlight(p, context, localMediaTop);
} else { } else {
paintHighlight(p, context, g.height()); paintHighlight(p, context, fullGeometry.height());
} }
const auto roll = media ? media->bubbleRoll() : Media::BubbleRoll(); const auto roll = media ? media->bubbleRoll() : Media::BubbleRoll();
if (roll) { if (roll) {
p.save(); p.save();
p.translate(g.center()); p.translate(fullGeometry.center());
p.rotate(roll.rotate); p.rotate(roll.rotate);
p.scale(roll.scale, roll.scale); p.scale(roll.scale, roll.scale);
p.translate(-g.center()); p.translate(-fullGeometry.center());
} }
p.setTextPalette(stm->textPalette); p.setTextPalette(stm->textPalette);
const auto keyboard = item->inlineReplyKeyboard();
const auto messageRounding = countMessageRounding(); const auto messageRounding = countMessageRounding();
if (keyboard) { 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); const auto keyboardPosition = QPoint(g.left(), g.top() + g.height() + st::msgBotKbButton.margin);
p.translate(keyboardPosition); p.translate(keyboardPosition);
keyboard->paint( keyboard->paint(