Fixed incorrect knob position for SliderComponent for non-zero minimum values.

This commit is contained in:
Leon Styhre 2020-08-08 12:33:55 +02:00
parent bd57d23bce
commit d45e72e10c
2 changed files with 2 additions and 1 deletions

View file

@ -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 * 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 * 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 * 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 * Lots and lots of additional small bugs and inconsistencies fixed

View file

@ -147,7 +147,7 @@ void SliderComponent::onValueChanged()
mKnob.setResize(0, mSize.y() * 0.7f); mKnob.setResize(0, mSize.y() * 0.7f);
float lineLength = mSize.x() - mKnob.getSize().x() - float lineLength = mSize.x() - mKnob.getSize().x() -
(mValueCache ? mValueCache->metrics.size.x() + 4 : 0); (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); mKnob.getSize().x()/2, mSize.y() / 2);
} }