[Horus] Sliders will stop always moving when around 0, just because of a bad rounding when negative

This commit is contained in:
Bertrand Songis
2016-03-19 00:09:06 +01:00
parent e8b783a491
commit b8068438fb
+2 -2
View File
@@ -257,7 +257,7 @@ void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max
}
} */
}
y += len - (val - min) * len / (max - min) - 5;
y += len - divRoundClosest(len * (val - min), max - min) - 5;
if (options & OPTION_SLIDER_TRIM_BUTTON) {
drawVerticalTrimPosition(x, y - 2, val);
}
@@ -272,7 +272,7 @@ void drawVerticalSlider(coord_t x, coord_t y, int len, int val, int min, int max
void drawHorizontalSlider(coord_t x, coord_t y, int len, int val, int min, int max, uint8_t steps, uint32_t options)
{
int w = (val - min) * len / (max - min);
int w = divRoundClosest(len * (val - min), max - min);
if (options & OPTION_SLIDER_TICKS) {
if (steps) {
int delta = len / steps;