mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
Everywhere: Use 'increase_slider_by()' method from AbstractSlider
This method help us to avoid repeating the pattern 'set_value(value() + delta)'.
This commit is contained in:
parent
8b8f404146
commit
d53e1fa1fa
Notes:
sideshowbarker
2024-07-17 21:55:29 +09:00
Author: https://github.com/elyse0
Commit: d53e1fa1fa
Pull-request: https://github.com/SerenityOS/serenity/pull/11163
Reviewed-by: https://github.com/kleinesfilmroellchen ✅
Reviewed-by: https://github.com/metmo ✅
12 changed files with 19 additions and 19 deletions
|
@ -46,7 +46,7 @@ ValueSlider::ValueSlider(Gfx::Orientation orientation, String suffix)
|
|||
|
||||
m_textbox->on_up_pressed = [&]() {
|
||||
if (value() < max())
|
||||
AbstractSlider::set_value(value() + 1);
|
||||
AbstractSlider::increase_slider_by(1);
|
||||
m_textbox->set_text(formatted_value());
|
||||
};
|
||||
|
||||
|
@ -159,7 +159,7 @@ void ValueSlider::leave_event(Core::Event&)
|
|||
void ValueSlider::mousewheel_event(MouseEvent& event)
|
||||
{
|
||||
if (event.wheel_delta() < 0)
|
||||
set_value(value() + 1);
|
||||
increase_slider_by(1);
|
||||
else
|
||||
set_value(value() - 1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue