diff --git a/Userland/Libraries/LibGUI/Slider.cpp b/Userland/Libraries/LibGUI/Slider.cpp index 02665a02e9..5c07c19d36 100644 --- a/Userland/Libraries/LibGUI/Slider.cpp +++ b/Userland/Libraries/LibGUI/Slider.cpp @@ -93,9 +93,9 @@ void Slider::mousedown_event(MouseEvent& event) if (jump_to_cursor()) { float normalized_mouse_offset = 0.0f; if (orientation() == Orientation::Vertical) { - normalized_mouse_offset = static_cast(mouse_offset) / static_cast(height()); + normalized_mouse_offset = static_cast(mouse_offset - track_margin()) / static_cast(inner_rect().height()); } else { - normalized_mouse_offset = static_cast(mouse_offset) / static_cast(width()); + normalized_mouse_offset = static_cast(mouse_offset - track_margin()) / static_cast(inner_rect().width()); } int new_value = static_cast(min() + ((max() - min()) * normalized_mouse_offset));