mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Put keyboard buttons above outside reactions.
This commit is contained in:
@@ -333,12 +333,6 @@ void Message::animateReaction(Ui::ReactionFlyAnimationArgs &&args) {
|
||||
const auto bubble = drawBubble();
|
||||
const auto reactionsInBubble = _reactions && embedReactionsInBubble();
|
||||
const auto mediaDisplayed = media && media->isDisplayed();
|
||||
const auto keyboard = item->inlineReplyKeyboard();
|
||||
auto keyboardHeight = 0;
|
||||
if (keyboard) {
|
||||
keyboardHeight = keyboard->naturalHeight();
|
||||
g.setHeight(g.height() - st::msgBotKbButton.margin - keyboardHeight);
|
||||
}
|
||||
|
||||
if (_reactions && !reactionsInBubble) {
|
||||
const auto reactionsHeight = st::mediaInBubbleSkip + _reactions->height();
|
||||
@@ -351,6 +345,13 @@ void Message::animateReaction(Ui::ReactionFlyAnimationArgs &&args) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto keyboard = item->inlineReplyKeyboard();
|
||||
auto keyboardHeight = 0;
|
||||
if (keyboard) {
|
||||
keyboardHeight = keyboard->naturalHeight();
|
||||
g.setHeight(g.height() - st::msgBotKbButton.margin - keyboardHeight);
|
||||
}
|
||||
|
||||
if (bubble) {
|
||||
// Entry page is always a bubble bottom.
|
||||
auto inner = g;
|
||||
@@ -861,13 +862,17 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||
const auto displayInfo = needInfoDisplay();
|
||||
const auto reactionsInBubble = _reactions && embedReactionsInBubble();
|
||||
|
||||
// We need to count geometry without keyboard and reactions
|
||||
// for bubble selection intervals counting below.
|
||||
auto gForIntervals = g;
|
||||
if (_reactions && !reactionsInBubble) {
|
||||
const auto reactionsHeight = st::mediaInBubbleSkip + _reactions->height();
|
||||
gForIntervals.setHeight(gForIntervals.height() - reactionsHeight);
|
||||
}
|
||||
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);
|
||||
gForIntervals.setHeight(gForIntervals.height() - keyboardHeight);
|
||||
}
|
||||
|
||||
auto mediaSelectionIntervals = (!context.selected() && mediaDisplayed)
|
||||
@@ -876,7 +881,7 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||
auto localMediaTop = 0;
|
||||
const auto customHighlight = mediaDisplayed && media->customHighlight();
|
||||
if (!mediaSelectionIntervals.empty() || customHighlight) {
|
||||
auto localMediaBottom = g.top() + g.height();
|
||||
auto localMediaBottom = gForIntervals.top() + gForIntervals.height();
|
||||
if (data()->repliesAreComments() || data()->externalReply()) {
|
||||
localMediaBottom -= st::historyCommentsButtonHeight;
|
||||
}
|
||||
@@ -911,7 +916,7 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||
if (customHighlight) {
|
||||
media->drawHighlight(p, context, localMediaTop);
|
||||
} else {
|
||||
paintHighlight(p, context, fullGeometry.height());
|
||||
paintHighlight(p, context, g.height());
|
||||
}
|
||||
if (selectionTranslation) {
|
||||
p.translate(selectionTranslation, 0);
|
||||
@@ -921,27 +926,14 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||
const auto roll = media ? media->bubbleRoll() : Media::BubbleRoll();
|
||||
if (roll) {
|
||||
p.save();
|
||||
p.translate(fullGeometry.center());
|
||||
p.translate(g.center());
|
||||
p.rotate(roll.rotate);
|
||||
p.scale(roll.scale, roll.scale);
|
||||
p.translate(-fullGeometry.center());
|
||||
p.translate(-g.center());
|
||||
}
|
||||
|
||||
p.setTextPalette(stm->textPalette);
|
||||
|
||||
const auto messageRounding = countMessageRounding();
|
||||
if (keyboard) {
|
||||
const auto keyboardPosition = QPoint(g.left(), g.top() + g.height() + st::msgBotKbButton.margin);
|
||||
p.translate(keyboardPosition);
|
||||
keyboard->paint(
|
||||
p,
|
||||
context.st,
|
||||
messageRounding,
|
||||
g.width(),
|
||||
context.clip.translated(-keyboardPosition));
|
||||
p.translate(-keyboardPosition);
|
||||
}
|
||||
|
||||
if (_reactions && !reactionsInBubble) {
|
||||
const auto reactionsHeight = st::mediaInBubbleSkip + _reactions->height();
|
||||
const auto reactionsLeft = (!bubble && mediaDisplayed)
|
||||
@@ -958,6 +950,22 @@ void Message::draw(Painter &p, const PaintContext &context) const {
|
||||
p.translate(-reactionsPosition);
|
||||
}
|
||||
|
||||
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(
|
||||
p,
|
||||
context.st,
|
||||
messageRounding,
|
||||
g.width(),
|
||||
context.clip.translated(-keyboardPosition));
|
||||
p.translate(-keyboardPosition);
|
||||
}
|
||||
|
||||
if (context.highlightPathCache) {
|
||||
context.highlightInterpolateTo = g;
|
||||
context.highlightPathCache->clear();
|
||||
@@ -2243,12 +2251,6 @@ TextState Message::textState(
|
||||
const auto bubble = drawBubble();
|
||||
const auto reactionsInBubble = _reactions && embedReactionsInBubble();
|
||||
const auto mediaDisplayed = media && media->isDisplayed();
|
||||
auto keyboard = item->inlineReplyKeyboard();
|
||||
auto keyboardHeight = 0;
|
||||
if (keyboard) {
|
||||
keyboardHeight = keyboard->naturalHeight();
|
||||
g.setHeight(g.height() - st::msgBotKbButton.margin - keyboardHeight);
|
||||
}
|
||||
|
||||
if (_reactions && !reactionsInBubble) {
|
||||
const auto reactionsHeight = st::mediaInBubbleSkip + _reactions->height();
|
||||
@@ -2263,6 +2265,22 @@ TextState Message::textState(
|
||||
}
|
||||
}
|
||||
|
||||
const auto keyboard = item->inlineReplyKeyboard();
|
||||
auto keyboardHeight = 0;
|
||||
if (keyboard) {
|
||||
keyboardHeight = keyboard->naturalHeight();
|
||||
g.setHeight(g.height() - st::msgBotKbButton.margin - keyboardHeight);
|
||||
|
||||
if (item->isHistoryEntry()) {
|
||||
const auto keyboardPosition = QPoint(g.left(), g.top() + g.height() + st::msgBotKbButton.margin);
|
||||
if (QRect(keyboardPosition, QSize(g.width(), keyboardHeight)).contains(point)) {
|
||||
result.symbol += visibleMediaTextLen + visibleTextLen;
|
||||
result.link = keyboard->getLink(point - keyboardPosition);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bubble) {
|
||||
const auto inBubble = g.contains(point);
|
||||
const auto check = factcheckBlock();
|
||||
@@ -2462,18 +2480,6 @@ TextState Message::textState(
|
||||
result.symbol += visibleTextLength();
|
||||
}
|
||||
|
||||
if (keyboard && item->isHistoryEntry()) {
|
||||
const auto keyboardTop = g.top()
|
||||
+ g.height()
|
||||
+ st::msgBotKbButton.margin
|
||||
+ ((_reactions && !reactionsInBubble)
|
||||
? (st::mediaInBubbleSkip + _reactions->height())
|
||||
: 0);
|
||||
if (QRect(g.left(), keyboardTop, g.width(), keyboardHeight).contains(point)) {
|
||||
result.link = keyboard->getLink(point - QPoint(g.left(), keyboardTop));
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -2827,7 +2833,14 @@ void Message::updatePressed(QPoint point) {
|
||||
}
|
||||
|
||||
auto g = countGeometry();
|
||||
auto keyboard = item->inlineReplyKeyboard();
|
||||
|
||||
const auto reactionsInBubble = _reactions && embedReactionsInBubble();
|
||||
if (_reactions && !reactionsInBubble) {
|
||||
const auto reactionsHeight = st::mediaInBubbleSkip + _reactions->height();
|
||||
g.setHeight(g.height() - reactionsHeight);
|
||||
}
|
||||
|
||||
const auto keyboard = item->inlineReplyKeyboard();
|
||||
if (keyboard) {
|
||||
auto keyboardHeight = st::msgBotKbButton.margin + keyboard->naturalHeight();
|
||||
g.setHeight(g.height() - keyboardHeight);
|
||||
|
||||
@@ -463,13 +463,6 @@ void Service::animateReaction(Ui::ReactionFlyAnimationArgs &&args) {
|
||||
const auto repainter = [=] { repaint(); };
|
||||
|
||||
const auto item = data();
|
||||
const auto keyboard = item->inlineReplyKeyboard();
|
||||
auto keyboardHeight = 0;
|
||||
if (keyboard) {
|
||||
keyboardHeight = keyboard->naturalHeight();
|
||||
g.setHeight(g.height() - st::msgBotKbButton.margin - keyboardHeight);
|
||||
}
|
||||
|
||||
if (_reactions) {
|
||||
const auto reactionsHeight = st::mediaInBubbleSkip + _reactions->height();
|
||||
const auto reactionsLeft = 0;
|
||||
@@ -632,30 +625,6 @@ void Service::draw(Painter &p, const PaintContext &context) const {
|
||||
const auto mediaDisplayed = media && media->isDisplayed();
|
||||
const auto onlyMedia = (mediaDisplayed && media->hideServiceText());
|
||||
|
||||
const auto item = data();
|
||||
const auto keyboard = item->inlineReplyKeyboard();
|
||||
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);
|
||||
}
|
||||
|
||||
if (keyboard) {
|
||||
const auto keyboardWidth = mediaDisplayed ? media->width() : g.width();
|
||||
const auto keyboardPosition = QPoint(
|
||||
g.left() + (g.width() - keyboardWidth) / 2,
|
||||
g.top() + g.height() + st::msgBotKbButton.margin);
|
||||
p.translate(keyboardPosition);
|
||||
keyboard->paint(
|
||||
p,
|
||||
context.st,
|
||||
KeyboardRounding(),
|
||||
keyboardWidth,
|
||||
context.clip.translated(-keyboardPosition));
|
||||
p.translate(-keyboardPosition);
|
||||
}
|
||||
|
||||
if (_reactions) {
|
||||
const auto reactionsHeight = st::mediaInBubbleSkip + _reactions->height();
|
||||
const auto reactionsLeft = 0;
|
||||
@@ -670,6 +639,28 @@ void Service::draw(Painter &p, const PaintContext &context) const {
|
||||
p.translate(-reactionsPosition);
|
||||
}
|
||||
|
||||
const auto item = data();
|
||||
const auto keyboard = item->inlineReplyKeyboard();
|
||||
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);
|
||||
|
||||
const auto keyboardWidth = mediaDisplayed ? media->width() : g.width();
|
||||
const auto keyboardPosition = QPoint(
|
||||
g.left() + (g.width() - keyboardWidth) / 2,
|
||||
g.top() + g.height() + st::msgBotKbButton.margin);
|
||||
p.translate(keyboardPosition);
|
||||
keyboard->paint(
|
||||
p,
|
||||
context.st,
|
||||
KeyboardRounding(),
|
||||
keyboardWidth,
|
||||
context.clip.translated(-keyboardPosition));
|
||||
p.translate(-keyboardPosition);
|
||||
}
|
||||
|
||||
if (!onlyMedia) {
|
||||
const auto mediaSkip = mediaDisplayed ? (st::msgServiceMargin.top() + media->height()) : 0;
|
||||
const auto trect = QRect(g.left(), g.top(), g.width(), g.height() - mediaSkip)
|
||||
@@ -745,6 +736,24 @@ TextState Service::textState(QPoint point, StateRequest request) const {
|
||||
return result;
|
||||
}
|
||||
|
||||
if (const auto service = Get<ServicePreMessage>()) {
|
||||
result.link = service->textState(point, request, g);
|
||||
if (result.link) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (_reactions) {
|
||||
const auto reactionsHeight = st::mediaInBubbleSkip + _reactions->height();
|
||||
const auto reactionsLeft = 0;
|
||||
g.setHeight(g.height() - reactionsHeight);
|
||||
const auto reactionsPosition = QPoint(reactionsLeft + g.left(), g.top() + g.height() + st::mediaInBubbleSkip);
|
||||
if (_reactions->getState(point - reactionsPosition, &result)) {
|
||||
//result.symbol += visibleMediaTextLen + visibleTextLen;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
auto keyboard = item->inlineReplyKeyboard();
|
||||
auto keyboardHeight = 0;
|
||||
if (keyboard) {
|
||||
@@ -765,24 +774,6 @@ TextState Service::textState(QPoint point, StateRequest request) const {
|
||||
}
|
||||
}
|
||||
|
||||
if (const auto service = Get<ServicePreMessage>()) {
|
||||
result.link = service->textState(point, request, g);
|
||||
if (result.link) {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (_reactions) {
|
||||
const auto reactionsHeight = st::mediaInBubbleSkip + _reactions->height();
|
||||
const auto reactionsLeft = 0;
|
||||
g.setHeight(g.height() - reactionsHeight);
|
||||
const auto reactionsPosition = QPoint(reactionsLeft + g.left(), g.top() + g.height() + st::mediaInBubbleSkip);
|
||||
if (_reactions->getState(point - reactionsPosition, &result)) {
|
||||
//result.symbol += visibleMediaTextLen + visibleTextLen;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (onlyMedia) {
|
||||
return media->textState(point - QPoint(st::msgServiceMargin.left() + (g.width() - media->width()) / 2, g.top()), request);
|
||||
} else if (mediaDisplayed) {
|
||||
|
||||
Reference in New Issue
Block a user