From d45e72e10ced55482119ac5e063df5de6979e2b2 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sat, 8 Aug 2020 12:33:55 +0200 Subject: [PATCH] Fixed incorrect knob position for SliderComponent for non-zero minimum values. --- NEWS.md | 1 + es-core/src/components/SliderComponent.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 405170c8a..5b062669f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -77,4 +77,5 @@ Many bugs have been fixed, and numerous features that were only partially implem * Hidden files still showed up if they had a gamelist.xml entry * On Unix, adding a hidden folder with a game in it crashed the application on startup * If the user tried to enter a blank game name in the metadata editor, the application would crash upon saving +* The SliderComponent knob position was set incorrectly if the minimum value was not zero * Lots and lots of additional small bugs and inconsistencies fixed diff --git a/es-core/src/components/SliderComponent.cpp b/es-core/src/components/SliderComponent.cpp index 7a928b914..86d48fbcf 100644 --- a/es-core/src/components/SliderComponent.cpp +++ b/es-core/src/components/SliderComponent.cpp @@ -147,7 +147,7 @@ void SliderComponent::onValueChanged() mKnob.setResize(0, mSize.y() * 0.7f); float lineLength = mSize.x() - mKnob.getSize().x() - (mValueCache ? mValueCache->metrics.size.x() + 4 : 0); - mKnob.setPosition(((mValue + mMin) / mMax) * lineLength + + mKnob.setPosition((mValue / mMax) * lineLength + mKnob.getSize().x()/2, mSize.y() / 2); }