1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:58:11 +00:00

ImageViewer: Fix window resizing on first image

The logic in place for this no longer worked since we abstracted away
the logic for zooming / panning (which changed how scale is stored).
This commit fixes the behaviour so when the first image is opened, the
window resizes to fit it.
This commit is contained in:
Mustafa Quraish 2022-01-21 03:46:50 -05:00 committed by Andreas Kling
parent 5c763e9832
commit 481ed1ca16

View file

@ -76,7 +76,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_title(String::formatted("{} {} {}% - Image Viewer", widget->path(), widget->bitmap()->size().to_string(), (int)(scale * 100)));
if (scale == 100 && !widget->scaled_for_first_image()) {
if (!widget->scaled_for_first_image()) {
widget->set_scaled_for_first_image(true);
widget->resize_window();
}