Guarded input for both directions in vertical drum picker.

This commit is contained in:
23rd 2023-08-21 16:50:49 +03:00 committed by John Preston
parent bb4476890f
commit d14e32f63e
1 changed files with 8 additions and 3 deletions

View File

@ -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;