From d14e32f63e12b72b07ec3010f8377435ed802869 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Mon, 21 Aug 2023 16:50:49 +0300 Subject: [PATCH] Guarded input for both directions in vertical drum picker. --- .../SourceFiles/ui/widgets/vertical_drum_picker.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/ui/widgets/vertical_drum_picker.cpp b/Telegram/SourceFiles/ui/widgets/vertical_drum_picker.cpp index 649c5129ba..87950995ae 100644 --- a/Telegram/SourceFiles/ui/widgets/vertical_drum_picker.cpp +++ b/Telegram/SourceFiles/ui/widgets/vertical_drum_picker.cpp @@ -101,9 +101,14 @@ VerticalDrumPicker::VerticalDrumPicker( } void VerticalDrumPicker::increaseShift(float64 by) { - // Guard input. - if (by >= 1.) { - by = .99; + { + // Guard input. + constexpr auto kAlmostIndex = .99; + if (by >= 1.) { + by = kAlmostIndex; + } else if (by <= -1.) { + by = -kAlmostIndex; + } } auto shift = _shift;