1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

PixelPaint: Make move_selection() cycle through layers

Previously move_selection() did not work as expected. Instead store the
selected layer index in a member variable and continue to cycle through
the layers when you come to the start/end. Also use it to scroll into
view. Lastly rename the function to cycle_through_selection() to make it
clearer what it does.
This commit is contained in:
Marcus Nilsson 2021-07-01 15:51:47 +02:00 committed by Andreas Kling
parent 8d205ae62e
commit e1906d74b8
3 changed files with 23 additions and 6 deletions

View file

@ -350,12 +350,12 @@ int main(int argc, char** argv)
layer_menu.add_separator();
layer_menu.add_action(GUI::Action::create(
"Select &Previous Layer", { 0, Key_PageUp }, [&](auto&) {
layer_list_widget.move_selection(1);
layer_list_widget.cycle_through_selection(1);
},
window));
layer_menu.add_action(GUI::Action::create(
"Select &Next Layer", { 0, Key_PageDown }, [&](auto&) {
layer_list_widget.move_selection(-1);
layer_list_widget.cycle_through_selection(-1);
},
window));
layer_menu.add_action(GUI::Action::create(