1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:38:10 +00:00

LibGUI: Add page_step setting to AbstractSlider and use it in Slider

This makes clicking on the track of a GUI::Slider actually move the
knob more than 1 value unit (assuming page_step > 1)
This commit is contained in:
Andreas Kling 2020-12-30 14:47:22 +01:00
parent fa836a4dda
commit 3b445bc66a
3 changed files with 12 additions and 2 deletions

View file

@ -105,9 +105,9 @@ void Slider::mousedown_event(MouseEvent& event)
return;
} else {
if (event.position().primary_offset_for_orientation(orientation()) > knob_rect().last_edge_for_orientation(orientation()))
set_value(value() + 1);
set_value(value() + page_step());
else if (event.position().primary_offset_for_orientation(orientation()) < knob_rect().first_edge_for_orientation(orientation()))
set_value(value() - 1);
set_value(value() - page_step());
}
}
return Widget::mousedown_event(event);