Преглед изворни кода

ImageViewer: Do not resize the window if the image fits into the window

Aziz Berkay Yesilyurt пре 4 година
родитељ
комит
41ebb12c9e
1 измењених фајлова са 6 додато и 1 уклоњено
  1. 6 1
      Userland/Applications/ImageViewer/ViewWidget.cpp

+ 6 - 1
Userland/Applications/ImageViewer/ViewWidget.cpp

@@ -277,7 +277,12 @@ void ViewWidget::drop_event(GUI::DropEvent& event)
 
 
 void ViewWidget::resize_window()
 void ViewWidget::resize_window()
 {
 {
-    if (window()->is_fullscreen())
+    if (window()->is_fullscreen() || window()->is_maximized())
+        return;
+
+    auto absolute_bitmap_rect = m_bitmap_rect;
+    absolute_bitmap_rect.translate_by(window()->rect().top_left());
+    if (window()->rect().contains(absolute_bitmap_rect))
         return;
         return;
 
 
     if (!m_bitmap)
     if (!m_bitmap)