From b43e46617587928866ec8b1133113d9e5370b09e Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 20 Oct 2023 17:37:16 +0200 Subject: [PATCH] Fixed an issue where the slider knob was sometimes not correctly positioned horizontally --- es-core/src/components/SliderComponent.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/es-core/src/components/SliderComponent.cpp b/es-core/src/components/SliderComponent.cpp index 181bf7bd8..00de12644 100644 --- a/es-core/src/components/SliderComponent.cpp +++ b/es-core/src/components/SliderComponent.cpp @@ -165,11 +165,6 @@ void SliderComponent::onValueChanged() mKnob.setResize(0.0f, std::round(mSize.y * 0.7f)); - float barLength { - mSize.x - mKnob.getSize().x - - (mTextCache ? mTextCache->metrics.size.x + (4.0f * mRenderer->getScreenWidthModifier()) : - 0.0f)}; - if (mRenderer->getScreenWidth() > mRenderer->getScreenHeight()) mBarHeight = std::round(2.0f * mRenderer->getScreenHeightModifier()); else @@ -185,6 +180,11 @@ void SliderComponent::onValueChanged() setSize(getSize().x, getSize().y - 1.0f); } + float barLength { + mSize.x - mKnob.getSize().x - + (mTextCache ? mTextCache->metrics.size.x + (4.0f * mRenderer->getScreenWidthModifier()) : + 0.0f)}; + // Likewise for the bar. if (static_cast(mSize.y) % 2 != static_cast(mBarHeight) % 2) { if (mBarHeight > 1.0f && mSize.y / mBarHeight < 5.0f)