diff --git a/radio/src/thirdparty/libopenui/src/roller.h b/radio/src/thirdparty/libopenui/src/roller.h index bd7199c2f..b2f567be8 100644 --- a/radio/src/thirdparty/libopenui/src/roller.h +++ b/radio/src/thirdparty/libopenui/src/roller.h @@ -66,15 +66,14 @@ class Roller: public Choice { void paint(BitmapBuffer * dc) override { int32_t value = getValue(); + auto valuesCount = getValuesCount(); int index = (scrollPositionY - ROLLER_LINE_HEIGHT + 1) / ROLLER_LINE_HEIGHT; coord_t y = index * ROLLER_LINE_HEIGHT; coord_t yMax = scrollPositionY + 3 * ROLLER_LINE_HEIGHT; while (y < yMax) { - auto displayedValue = getValueFromIndex(index % getValuesCount()); - if (displayedValue < vmin) - displayedValue += getValuesCount(); + auto displayedValue = getValueFromIndex((index + valuesCount) % valuesCount); auto fgColor = DISABLE_COLOR; @@ -130,10 +129,8 @@ class Roller: public Choice { { lastScrollPositionY = scrollPositionY; - auto newValue = getValueFromIndex(((scrollPositionY / ROLLER_LINE_HEIGHT) + 1) % getValuesCount()); - if (newValue < vmin) { - newValue += getValuesCount(); - } + auto valuesCount = getValuesCount(); + auto newValue = getValueFromIndex((((scrollPositionY / ROLLER_LINE_HEIGHT) + 1) + valuesCount) % valuesCount); setValue(newValue); invalidate();