From 508ba4750cad8e2429dd26629fb90321b9cb8a9c Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 5 Jan 2022 22:29:11 +0300 Subject: [PATCH] Show appear animations in reactions dropdown. --- .../view/history_view_react_button.cpp | 64 +++++++++++++++++-- .../history/view/history_view_react_button.h | 4 ++ Telegram/SourceFiles/ui/chat/chat.style | 1 + 3 files changed, 64 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_react_button.cpp b/Telegram/SourceFiles/history/view/history_view_react_button.cpp index dfc3db8f5..9eeab7e26 100644 --- a/Telegram/SourceFiles/history/view/history_view_react_button.cpp +++ b/Telegram/SourceFiles/history/view/history_view_react_button.cpp @@ -35,6 +35,7 @@ constexpr auto kButtonExpandDelay = crl::time(25); constexpr auto kButtonHideDelay = crl::time(300); constexpr auto kButtonExpandedHideDelay = crl::time(0); constexpr auto kSizeForDownscale = 96; +constexpr auto kHoverScale = 1.2; [[nodiscard]] QPoint LocalPosition(not_null e) { #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) @@ -98,6 +99,10 @@ bool Button::isHidden() const { return (_state == State::Hidden) && !_opacityAnimation.animating(); } +bool Button::hasInitialView() const { + return (_geometry.height() == _collapsed.height()); +} + QRect Button::geometry() const { return _geometry; } @@ -368,6 +373,9 @@ void Manager::updateButton(ButtonParameters parameters) { return; } else if (_button) { _button->applyParameters(parameters); + if (_button->hasInitialView()) { + clearAppearAnimations(); + } return; } else if (parameters.outside) { _buttonShowTimer.cancel(); @@ -386,6 +394,7 @@ void Manager::updateButton(ButtonParameters parameters) { } void Manager::showButtonDelayed() { + clearAppearAnimations(); _button = std::make_unique