mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-07 19:57:45 +03:00
LibGUI+SoundPlayer: Use 'increase_slider_by_page_steps()'
This method allow us to avoid repeating the pattern 'set_value(value() + page_step() * page_number)'.
This commit is contained in:
parent
8d1fb299b1
commit
0d660b27ae
Notes:
sideshowbarker
2024-07-17 21:55:11 +09:00
Author: https://github.com/elyse0 Commit: https://github.com/SerenityOS/serenity/commit/0d660b27ae4 Pull-request: https://github.com/SerenityOS/serenity/pull/11163 Reviewed-by: https://github.com/kleinesfilmroellchen ✅ Reviewed-by: https://github.com/metmo ✅
@ -149,7 +149,7 @@ void SoundPlayerWidgetAdvancedView::keydown_event(GUI::KeyEvent& event)
|
||||
m_stop_button->click();
|
||||
|
||||
if (event.key() == Key_Up)
|
||||
m_volume_slider->set_value(m_volume_slider->value() + m_volume_slider->page_step());
|
||||
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());
|
||||
|
@ -104,7 +104,7 @@ void Slider::mousedown_event(MouseEvent& event)
|
||||
auto knob_first_edge = knob_rect().first_edge_for_orientation(orientation());
|
||||
auto knob_last_edge = knob_rect().last_edge_for_orientation(orientation());
|
||||
if (mouse_offset > knob_last_edge)
|
||||
set_value(value() + page_step());
|
||||
increase_slider_by_page_steps(1);
|
||||
else if (mouse_offset < knob_first_edge)
|
||||
set_value(value() - page_step());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user