From 5ee7cb4dbfda1a10d78d398acb949fca392c6e61 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 21 Aug 2023 17:56:57 +0300 Subject: [PATCH] Improved mouse wheel handling in vertical drum picker without animation. --- Telegram/SourceFiles/ui/widgets/vertical_drum_picker.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/ui/widgets/vertical_drum_picker.cpp b/Telegram/SourceFiles/ui/widgets/vertical_drum_picker.cpp index 87950995a..9e546e004 100644 --- a/Telegram/SourceFiles/ui/widgets/vertical_drum_picker.cpp +++ b/Telegram/SourceFiles/ui/widgets/vertical_drum_picker.cpp @@ -12,8 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL namespace Ui { -PickerAnimation::PickerAnimation() { -} +PickerAnimation::PickerAnimation() = default; void PickerAnimation::jumpToOffset(int offset) { _result.from = _result.current; @@ -95,8 +94,13 @@ VerticalDrumPicker::VerticalDrumPicker( }, lifetime()); _animation.updates( + ) | rpl::distinct_until_changed( ) | rpl::start_with_next([=](PickerAnimation::Shift shift) { increaseShift(shift); + if (anim::Disabled()) { + animationDataFromIndex(); + _animation.jumpToOffset(0); + } }, lifetime()); }