aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/widget.cpp6
-rw-r--r--gui/widget.h1
2 files changed, 6 insertions, 1 deletions
diff --git a/gui/widget.cpp b/gui/widget.cpp
index ade68fd46d..5754c12dd1 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -328,7 +328,11 @@ void SliderWidget::handleMouseWheel(int x, int y, int direction) {
}
void SliderWidget::drawWidget() {
- g_gui.theme()->drawSlider(Common::Rect(_x, _y, _x + _w, _y + _h), valueToPos(_value) + 1, _state);
+ g_gui.theme()->drawSlider(Common::Rect(_x, _y, _x + _w, _y + _h), valueToBarWidth(_value), _state);
+}
+
+int SliderWidget::valueToBarWidth(int value) {
+ return (_w * (value - _valueMin) / (_valueMax - _valueMin));
}
int SliderWidget::valueToPos(int value) {
diff --git a/gui/widget.h b/gui/widget.h
index 39bf81b352..6fc4113ca6 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -236,6 +236,7 @@ protected:
int valueToPos(int value);
int posToValue(int pos);
+ int valueToBarWidth(int value);
};
/* GraphicsWidget */