Skip to content

Commit

Permalink
Notifications: stop fading in before starting to fade out
Browse files Browse the repository at this point in the history
When a notification is to start hiding (i.e., fade out), it is supposed
to start fading out from the maximum opacity, even if it was not fully
restored (which only happens if the cursor passed through the
notification too quickly). Thus, call `.stop()` for the previous
animation, if any, before `.start()`ing the next animation.
  • Loading branch information
kolayne committed Jan 28, 2025
1 parent f842168 commit a7b47e1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Telegram/SourceFiles/window/notifications_manager_default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,10 @@ void Widget::hideStop() {

void Widget::hideAnimated(float64 duration, const anim::transition &func) {
_hiding = true;
// Stop the previous animation so as to make sure that the notification
// is fully restored before hiding it again.
// Relates to https://github.com/telegramdesktop/tdesktop/issues/28811.
_a_opacity.stop();
_a_opacity.start([this] { opacityAnimationCallback(); }, 1., 0., duration, func);
}

Expand Down

0 comments on commit a7b47e1

Please sign in to comment.