mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 09:51:57 -05:00
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. :^)
This commit is contained in:
parent
82b0171812
commit
eeb3ef405c
1 changed files with 7 additions and 2 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue