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

View File

@ -101,9 +101,14 @@ VerticalDrumPicker::VerticalDrumPicker(
} }
void VerticalDrumPicker::increaseShift(float64 by) { void VerticalDrumPicker::increaseShift(float64 by) {
// Guard input. {
if (by >= 1.) { // Guard input.
by = .99; constexpr auto kAlmostIndex = .99;
if (by >= 1.) {
by = kAlmostIndex;
} else if (by <= -1.) {
by = -kAlmostIndex;
}
} }
auto shift = _shift; auto shift = _shift;