mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 19:05:07 +00: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)
|
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)
|
if (orientation() == Orientation::Horizontal)
|
||||||
set_value(value() - event.wheel_delta() * m_step);
|
set_value(value() - event.wheel_delta() * acceleration_modifier);
|
||||||
else
|
else
|
||||||
set_value(value() + event.wheel_delta() * m_step);
|
set_value(value() + event.wheel_delta() * acceleration_modifier);
|
||||||
|
|
||||||
Widget::mousewheel_event(event);
|
Widget::mousewheel_event(event);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue