From eeb3ef405cc2216b7d9257f95846f37ea7fc10c0 Mon Sep 17 00:00:00 2001 From: Jakob-Niklas See Date: Sat, 19 Sep 2020 16:45:51 +0200 Subject: [PATCH] LibGUI: Increase slider acceleration with Ctrl (#3499) When holding Ctrl and scrolling on a slider widget, the scrolling acceleration gets increased. This can make it faster to get to the knob location you want to get to. :^) --- Libraries/LibGUI/Slider.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Libraries/LibGUI/Slider.cpp b/Libraries/LibGUI/Slider.cpp index 08b8fb55753..89673ed0336 100644 --- a/Libraries/LibGUI/Slider.cpp +++ b/Libraries/LibGUI/Slider.cpp @@ -159,10 +159,15 @@ void Slider::mouseup_event(MouseEvent& event) void Slider::mousewheel_event(MouseEvent& event) { + auto acceleration_modifier = m_step; + + if (event.modifiers() == KeyModifier::Mod_Ctrl && knob_size_mode() == KnobSizeMode::Fixed) + acceleration_modifier *= 6; + if (orientation() == Orientation::Horizontal) - set_value(value() - event.wheel_delta() * m_step); + set_value(value() - event.wheel_delta() * acceleration_modifier); else - set_value(value() + event.wheel_delta() * m_step); + set_value(value() + event.wheel_delta() * acceleration_modifier); Widget::mousewheel_event(event); }