diff options
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibGUI/Slider.cpp | 9 | ||||
-rw-r--r-- | Userland/Libraries/LibGUI/SpinBox.cpp | 5 |
2 files changed, 10 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/Slider.cpp b/Userland/Libraries/LibGUI/Slider.cpp index 9aac47ee11..5689a36868 100644 --- a/Userland/Libraries/LibGUI/Slider.cpp +++ b/Userland/Libraries/LibGUI/Slider.cpp @@ -144,14 +144,17 @@ void Slider::mouseup_event(MouseEvent& event) void Slider::mousewheel_event(MouseEvent& event) { auto acceleration_modifier = step(); + auto wheel_delta = event.wheel_delta(); - if (event.modifiers() == KeyModifier::Mod_Ctrl && knob_size_mode() == KnobSizeMode::Fixed) + if (event.modifiers() == KeyModifier::Mod_Ctrl) acceleration_modifier *= 6; + if (knob_size_mode() == KnobSizeMode::Proportional) + wheel_delta /= abs(wheel_delta); if (orientation() == Orientation::Horizontal) - set_value(value() - event.wheel_delta() * acceleration_modifier); + set_value(value() - wheel_delta * acceleration_modifier); else - set_value(value() + event.wheel_delta() * acceleration_modifier); + set_value(value() + wheel_delta * acceleration_modifier); Widget::mousewheel_event(event); } diff --git a/Userland/Libraries/LibGUI/SpinBox.cpp b/Userland/Libraries/LibGUI/SpinBox.cpp index 35967afab5..f0c82b935e 100644 --- a/Userland/Libraries/LibGUI/SpinBox.cpp +++ b/Userland/Libraries/LibGUI/SpinBox.cpp @@ -105,7 +105,10 @@ void SpinBox::set_range(int min, int max) void SpinBox::mousewheel_event(MouseEvent& event) { - set_value(m_value - event.wheel_delta()); + auto wheel_delta = event.wheel_delta() / abs(event.wheel_delta()); + if (event.modifiers() == KeyModifier::Mod_Ctrl) + wheel_delta *= 6; + set_value(m_value - wheel_delta); } void SpinBox::resize_event(ResizeEvent& event) |