1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-10 18:10:56 +09: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:
Mustafa Quraish 2022-01-21 03:56:32 -05:00 committed by Andreas Kling
parent 481ed1ca16
commit 4556b8e943
Notes: sideshowbarker 2024-07-17 18:50:25 +09:00

View file

@ -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());