diff options
author | Mustafa Quraish <mustafaq9@gmail.com> | 2022-01-21 03:56:32 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-02-14 11:49:21 +0100 |
commit | 4556b8e94346c6de86af58a82cf64ad107dbc3bd (patch) | |
tree | 40de89f625828644f2ec0f29f3d9e761b55445ae /Userland/Applications | |
parent | 481ed1ca16169d62b5857e386c3ffad7ef151cc0 (diff) | |
download | serenity-4556b8e94346c6de86af58a82cf64ad107dbc3bd.zip |
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).
Diffstat (limited to 'Userland/Applications')
-rw-r--r-- | Userland/Applications/ImageViewer/main.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp index 6dd596e1c6..679d7dbbbe 100644 --- a/Userland/Applications/ImageViewer/main.cpp +++ b/Userland/Applications/ImageViewer/main.cpp @@ -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()); |