From 04617e4a1215561cfa8e32ad3dc409b13a47918c Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Wed, 21 Aug 2019 13:18:41 +0300 Subject: [PATCH] Fixed display of tooltip for date of stickers. - Fixed #6426. - Regression was introduced in b814c6307aee395cf2b25948b4639d648928af27. --- .../view/media/history_view_media_unwrapped.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp b/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp index f4e52bc344..fdc16644fe 100644 --- a/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp +++ b/Telegram/SourceFiles/history/view/media/history_view_media_unwrapped.cpp @@ -150,7 +150,7 @@ void UnwrappedMedia::drawSurrounding( const auto rightAction = _parent->displayRightAction(); const auto fullRight = calculateFullRight(inner); auto fullBottom = height(); - if (rightAction ? true : needInfoDisplay()) { + if (needInfoDisplay()) { _parent->drawInfo( p, fullRight, @@ -217,13 +217,19 @@ PointState UnwrappedMedia::pointState(QPoint point) const { usex = width() - usex - usew; } + const auto datey = height() - st::msgDateImgPadding.y() * 2 + - st::msgDateFont->height; const auto usey = rightAligned ? 0 : (height() - _contentSize.height()); const auto useh = rightAligned - ? std::max( - _contentSize.height(), - height() - st::msgDateImgPadding.y() * 2 - st::msgDateFont->height) + ? std::max(_contentSize.height(), datey) : _contentSize.height(); const auto inner = QRect(usex, usey, usew, useh); + + // Rectangle of date bubble. + if (point.x() < calculateFullRight(inner) && point.y() > datey) { + return PointState::Inside; + } + return inner.contains(point) ? PointState::Inside : PointState::Outside; } @@ -358,6 +364,7 @@ QPoint UnwrappedMedia::calculateFastActionPosition( bool UnwrappedMedia::needInfoDisplay() const { return (_parent->data()->id < 0) || (_parent->isUnderCursor()) + || (_parent->displayRightAction()) || (_parent->hasOutLayout() && !Adaptive::ChatWide() && _content->alwaysShowOutTimestamp());