Slightly improved style of sub-button in sponsored messages.

This commit is contained in:
23rd 2024-04-22 22:47:13 +03:00 committed by John Preston
parent eef65af173
commit b35d3f57fe
2 changed files with 6 additions and 8 deletions

View file

@ -897,12 +897,10 @@ void WebPage::draw(Painter &p, const PaintContext &context) const {
const auto height = st::webPageSponsoredHintFont->height; const auto height = st::webPageSponsoredHintFont->height;
const auto radius = height / 2; const auto radius = height / 2;
_sponsoredData->lastHintPos = QPoint( _sponsoredData->lastHintPos = QPointF(
radius + inner.left() + _sponsoredData->widthBeforeHint, radius + inner.left() + _sponsoredData->widthBeforeHint,
tshift tshift + (_siteName.style()->font->height - height) / 2.);
+ (_siteName.style()->font->height - height) / 2 const auto rect = QRectF(
+ st::webPageSponsoredHintFont->descent / 2);
const auto rect = QRect(
_sponsoredData->lastHintPos, _sponsoredData->lastHintPos,
_sponsoredData->hintSize); _sponsoredData->hintSize);
auto hq = PainterHighQualityEnabler(p); auto hq = PainterHighQualityEnabler(p);
@ -1205,7 +1203,7 @@ TextState WebPage::textState(QPoint point, StateRequest request) const {
result.link = _openl; result.link = _openl;
} }
if (_sponsoredData && _sponsoredData->canReport) { if (_sponsoredData && _sponsoredData->canReport) {
const auto contains = QRect( const auto contains = QRectF(
_sponsoredData->lastHintPos, _sponsoredData->lastHintPos,
_sponsoredData->hintSize).contains(point _sponsoredData->hintSize).contains(point
- QPoint(0, st::msgDateFont->height)); - QPoint(0, st::msgDateFont->height));
@ -1298,7 +1296,7 @@ void WebPage::clickHandlerPressedChanged(
const auto outer = full - inBubblePadding(); const auto outer = full - inBubblePadding();
_sponsoredData->hintRipple->add(_lastPoint _sponsoredData->hintRipple->add(_lastPoint
+ outer.topLeft() + outer.topLeft()
- _sponsoredData->lastHintPos); - _sponsoredData->lastHintPos.toPoint());
} else if (_sponsoredData->hintRipple) { } else if (_sponsoredData->hintRipple) {
_sponsoredData->hintRipple->lastStop(); _sponsoredData->hintRipple->lastStop();
} }

View file

@ -149,7 +149,7 @@ private:
bool canReport = false; bool canReport = false;
QSize hintSize; QSize hintSize;
QPoint lastHintPos; QPointF lastHintPos;
int widthBeforeHint = 0; int widthBeforeHint = 0;
std::unique_ptr<Ui::RippleAnimation> hintRipple; std::unique_ptr<Ui::RippleAnimation> hintRipple;
ClickHandlerPtr hintLink; ClickHandlerPtr hintLink;