summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI/Slider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibGUI/Slider.cpp')
-rw-r--r--Libraries/LibGUI/Slider.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Libraries/LibGUI/Slider.cpp b/Libraries/LibGUI/Slider.cpp
index 89673ed033..bd85a0b05a 100644
--- a/Libraries/LibGUI/Slider.cpp
+++ b/Libraries/LibGUI/Slider.cpp
@@ -96,13 +96,13 @@ Gfx::IntRect Slider::knob_rect() const
if (knob_size_mode() == KnobSizeMode::Fixed) {
if (m_max - m_min) {
float scale = (float)inner_rect.primary_size_for_orientation(orientation()) / (float)(m_max - m_min);
- rect.set_primary_offset_for_orientation(orientation(), inner_rect.primary_offset_for_orientation(orientation()) + ((int)(m_value * scale)) - (knob_fixed_primary_size() / 2));
+ rect.set_primary_offset_for_orientation(orientation(), inner_rect.primary_offset_for_orientation(orientation()) + ((int)((m_value - m_min) * scale)) - (knob_fixed_primary_size() / 2));
} else
rect.set_primary_size_for_orientation(orientation(), 0);
rect.set_primary_size_for_orientation(orientation(), knob_fixed_primary_size());
} else {
float scale = (float)inner_rect.primary_size_for_orientation(orientation()) / (float)(m_max - m_min + 1);
- rect.set_primary_offset_for_orientation(orientation(), inner_rect.primary_offset_for_orientation(orientation()) + ((int)(m_value * scale)));
+ rect.set_primary_offset_for_orientation(orientation(), inner_rect.primary_offset_for_orientation(orientation()) + ((int)((m_value - m_min) * scale)));
if (m_max - m_min)
rect.set_primary_size_for_orientation(orientation(), ::max((int)(scale), knob_fixed_primary_size()));
else