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:
parent
481ed1ca16
commit
4556b8e943
Notes:
sideshowbarker
2024-07-17 18:50:25 +09:00
Author: https://github.com/mustafaquraish
Commit: 4556b8e943
Pull-request: https://github.com/SerenityOS/serenity/pull/12035
Reviewed-by: https://github.com/alimpfard
1 changed files with 6 additions and 0 deletions
|
@ -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());
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue