From 35cc61cb485a0606aea42a4713f9d91c23bd55c8 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 31 Jan 2023 18:32:02 +0300 Subject: [PATCH] Added ability to finish animation of toggle in SettingsButton. --- ui/widgets/buttons.cpp | 7 +++++++ ui/widgets/buttons.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/ui/widgets/buttons.cpp b/ui/widgets/buttons.cpp index 35d6669..fc5e1aa 100644 --- a/ui/widgets/buttons.cpp +++ b/ui/widgets/buttons.cpp @@ -709,6 +709,13 @@ SettingsButton::SettingsButton( SettingsButton::~SettingsButton() = default; +void SettingsButton::finishAnimating() { + if (_toggle) { + _toggle->finishAnimating(); + } + Ui::RippleButton::finishAnimating(); +} + SettingsButton *SettingsButton::toggleOn( rpl::producer &&toggled, bool ignoreClick) { diff --git a/ui/widgets/buttons.h b/ui/widgets/buttons.h index 1885292..cdc9040 100644 --- a/ui/widgets/buttons.h +++ b/ui/widgets/buttons.h @@ -277,6 +277,8 @@ public: [[nodiscard]] const style::SettingsButton &st() const; [[nodiscard]] int fullTextWidth() const; + void finishAnimating(); + protected: int resizeGetHeight(int newWidth) override; void onStateChanged(