mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-28 02:27:19 +02:00
LibGUI+LibWeb: Use 'increase_slider_by_steps()' method
This method allow us to avoid repeating the pattern 'set_value(value() + step() * step_number)'.
This commit is contained in:
Notes:
sideshowbarker
2024-07-17 21:55:20 +09:00
Author: https://github.com/elyse0 Commit: https://github.com/SerenityOS/serenity/commit/cee4e021342 Pull-request: https://github.com/SerenityOS/serenity/pull/11163 Reviewed-by: https://github.com/kleinesfilmroellchen ✅ Reviewed-by: https://github.com/metmo ✅
@@ -232,7 +232,7 @@ void Scrollbar::on_automatic_scrolling_timer_fired()
|
||||
return;
|
||||
}
|
||||
if (m_pressed_component == Component::IncrementButton && component_at_position(m_last_mouse_position) == Component::IncrementButton) {
|
||||
set_value(value() + step());
|
||||
increase_slider_by_steps(1);
|
||||
return;
|
||||
}
|
||||
if (m_pressed_component == Component::Gutter && component_at_position(m_last_mouse_position) == Component::Gutter) {
|
||||
@@ -299,7 +299,7 @@ void Scrollbar::mousewheel_event(MouseEvent& event)
|
||||
{
|
||||
if (!is_scrollable())
|
||||
return;
|
||||
set_value(value() + event.wheel_delta() * step());
|
||||
increase_slider_by_steps(event.wheel_delta());
|
||||
Widget::mousewheel_event(event);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user