summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLucas CHOLLET <lucas.chollet@free.fr>2023-03-22 01:23:31 -0400
committerAndreas Kling <kling@serenityos.org>2023-03-22 23:22:58 +0100
commitc574b972464553e18640b8fc6889ddd2cc4788c5 (patch)
treec72e6f79b0a15bfd2463fd6896081f5b8874cc59
parent5cceae821ddc9020d21d8c1caf6409d12000a8dc (diff)
downloadserenity-c574b972464553e18640b8fc6889ddd2cc4788c5.zip
ImageViewer: Scale image to window size on image change
-rw-r--r--Userland/Applications/ImageViewer/ViewWidget.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Userland/Applications/ImageViewer/ViewWidget.cpp b/Userland/Applications/ImageViewer/ViewWidget.cpp
index 80cad1c7e3..86c033a7e4 100644
--- a/Userland/Applications/ImageViewer/ViewWidget.cpp
+++ b/Userland/Applications/ImageViewer/ViewWidget.cpp
@@ -192,7 +192,11 @@ void ViewWidget::load_from_file(DeprecatedString const& path)
m_path = Core::DeprecatedFile::real_path_for(path);
GUI::Application::the()->set_most_recently_open_file(String::from_utf8(path).release_value_but_fixme_should_propagate_errors());
- reset_view();
+
+ if (scaled_for_first_image())
+ scale_image_for_window();
+ else
+ reset_view();
}
void ViewWidget::drag_enter_event(GUI::DragEvent& event)