Improved mouse wheel handling in vertical drum picker without animation.

This commit is contained in:
23rd 2023-08-21 17:56:57 +03:00 committed by John Preston
parent d14e32f63e
commit 5ee7cb4dbf
1 changed files with 6 additions and 2 deletions

View File

@ -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());
}