Roller fixes
This commit is contained in:
+4
-7
@@ -66,15 +66,14 @@ class Roller: public Choice {
|
|||||||
void paint(BitmapBuffer * dc) override
|
void paint(BitmapBuffer * dc) override
|
||||||
{
|
{
|
||||||
int32_t value = getValue();
|
int32_t value = getValue();
|
||||||
|
auto valuesCount = getValuesCount();
|
||||||
|
|
||||||
int index = (scrollPositionY - ROLLER_LINE_HEIGHT + 1) / ROLLER_LINE_HEIGHT;
|
int index = (scrollPositionY - ROLLER_LINE_HEIGHT + 1) / ROLLER_LINE_HEIGHT;
|
||||||
coord_t y = index * ROLLER_LINE_HEIGHT;
|
coord_t y = index * ROLLER_LINE_HEIGHT;
|
||||||
coord_t yMax = scrollPositionY + 3 * ROLLER_LINE_HEIGHT;
|
coord_t yMax = scrollPositionY + 3 * ROLLER_LINE_HEIGHT;
|
||||||
|
|
||||||
while (y < yMax) {
|
while (y < yMax) {
|
||||||
auto displayedValue = getValueFromIndex(index % getValuesCount());
|
auto displayedValue = getValueFromIndex((index + valuesCount) % valuesCount);
|
||||||
if (displayedValue < vmin)
|
|
||||||
displayedValue += getValuesCount();
|
|
||||||
|
|
||||||
auto fgColor = DISABLE_COLOR;
|
auto fgColor = DISABLE_COLOR;
|
||||||
|
|
||||||
@@ -130,10 +129,8 @@ class Roller: public Choice {
|
|||||||
{
|
{
|
||||||
lastScrollPositionY = scrollPositionY;
|
lastScrollPositionY = scrollPositionY;
|
||||||
|
|
||||||
auto newValue = getValueFromIndex(((scrollPositionY / ROLLER_LINE_HEIGHT) + 1) % getValuesCount());
|
auto valuesCount = getValuesCount();
|
||||||
if (newValue < vmin) {
|
auto newValue = getValueFromIndex((((scrollPositionY / ROLLER_LINE_HEIGHT) + 1) + valuesCount) % valuesCount);
|
||||||
newValue += getValuesCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
setValue(newValue);
|
setValue(newValue);
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|||||||
Reference in New Issue
Block a user