mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-01 07:52:50 +00:00
LibGUI+SoundPlayer: Use 'decrease_slider_by_page_steps()' method
This method allow us to avoid repeating the pattern 'set_value(value() - page_step() * page_number)'.
This commit is contained in:
parent
0d660b27ae
commit
173a84a2ef
Notes:
sideshowbarker
2024-07-17 21:55:07 +09:00
Author: https://github.com/elyse0
Commit: 173a84a2ef
Pull-request: https://github.com/SerenityOS/serenity/pull/11163
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
Reviewed-by: https://github.com/metmo ✅
2 changed files with 2 additions and 2 deletions
|
@ -152,7 +152,7 @@ void SoundPlayerWidgetAdvancedView::keydown_event(GUI::KeyEvent& event)
|
|||
m_volume_slider->increase_slider_by_page_steps(1);
|
||||
|
||||
if (event.key() == Key_Down)
|
||||
m_volume_slider->set_value(m_volume_slider->value() - m_volume_slider->page_step());
|
||||
m_volume_slider->decrease_slider_by_page_steps(1);
|
||||
|
||||
GUI::Widget::keydown_event(event);
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ void Slider::mousedown_event(MouseEvent& event)
|
|||
if (mouse_offset > knob_last_edge)
|
||||
increase_slider_by_page_steps(1);
|
||||
else if (mouse_offset < knob_first_edge)
|
||||
set_value(value() - page_step());
|
||||
decrease_slider_by_page_steps(1);
|
||||
}
|
||||
}
|
||||
return Widget::mousedown_event(event);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue