mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Fix clickable geometry of "via @bot".
This commit is contained in:
@@ -153,6 +153,7 @@ void HistoryMessageVia::resize(int32 availw) const {
|
||||
tr::now,
|
||||
lt_inline_bot,
|
||||
'@' + bot->username());
|
||||
maxWidth = st::msgServiceNameFont->width(text);
|
||||
if (availw < maxWidth) {
|
||||
text = st::msgServiceNameFont->elided(text, availw);
|
||||
width = st::msgServiceNameFont->width(text);
|
||||
|
||||
@@ -1865,7 +1865,6 @@ void Message::paintFromName(
|
||||
} else {
|
||||
st::dialogsPremiumIcon.icon.paint(p, x, y, width(), color);
|
||||
}
|
||||
availableWidth -= statusWidth;
|
||||
}
|
||||
p.setFont(st::msgNameFont);
|
||||
p.setPen(nameFg);
|
||||
@@ -3297,7 +3296,6 @@ bool Message::getStateFromName(
|
||||
outResult->link = _fromNameStatus->link;
|
||||
return true;
|
||||
}
|
||||
availableWidth -= statusWidth;
|
||||
}
|
||||
if (point.x() >= availableLeft
|
||||
&& point.x() < availableLeft + availableWidth
|
||||
@@ -3307,12 +3305,22 @@ bool Message::getStateFromName(
|
||||
_fromLinkRipplePointSet = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto skipWidth = nameText->maxWidth()
|
||||
+ (_fromNameStatus
|
||||
? (st::dialogsPremiumIcon.icon.width()
|
||||
+ st::msgServiceFont->spacew)
|
||||
: 0)
|
||||
+ st::msgServiceFont->spacew;
|
||||
availableLeft += skipWidth;
|
||||
availableWidth -= skipWidth;
|
||||
|
||||
auto via = item->Get<HistoryMessageVia>();
|
||||
if (via
|
||||
&& !displayForwardedFrom()
|
||||
&& point.x() >= availableLeft + nameText->maxWidth() + st::msgServiceFont->spacew
|
||||
&& point.x() >= availableLeft
|
||||
&& point.x() < availableLeft + availableWidth
|
||||
&& point.x() < availableLeft + nameText->maxWidth() + st::msgServiceFont->spacew + via->width) {
|
||||
&& point.x() < availableLeft + via->width) {
|
||||
outResult->link = via->link;
|
||||
recordLinkRipplePoint(point, trect.topLeft());
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user