mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
ImageViewer: Add "Fit Image to View" action
This is analogous to PixelPaint, it resizes the image so that it fits in the view (with some padding).
This commit is contained in:
committed by
Andreas Kling
parent
481ed1ca16
commit
4556b8e943
@@ -215,6 +215,11 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
},
|
||||
window);
|
||||
|
||||
auto fit_image_to_view_action = GUI::Action::create(
|
||||
"Fit Image To &View", [&](auto&) {
|
||||
widget->fit_content_to_view();
|
||||
});
|
||||
|
||||
auto zoom_out_action = GUI::CommonActions::make_zoom_out_action(
|
||||
[&](auto&) {
|
||||
widget->set_scale(widget->scale() / 1.44f);
|
||||
@@ -301,6 +306,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||
TRY(view_menu->try_add_separator());
|
||||
TRY(view_menu->try_add_action(zoom_in_action));
|
||||
TRY(view_menu->try_add_action(reset_zoom_action));
|
||||
TRY(view_menu->try_add_action(fit_image_to_view_action));
|
||||
TRY(view_menu->try_add_action(zoom_out_action));
|
||||
TRY(view_menu->try_add_separator());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user