mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28:11 +00:00
ImageViewer: Don't resize the window after the first image is displayed
This commit is contained in:
parent
36c8b1c58c
commit
dd476c35cb
2 changed files with 5 additions and 1 deletions
|
@ -32,6 +32,8 @@ public:
|
|||
int scale() { return m_scale; }
|
||||
void set_toolbar_height(int height) { m_toolbar_height = height; }
|
||||
int toolbar_height() { return m_toolbar_height; }
|
||||
bool scaled_for_first_image() { return m_scaled_for_first_image; }
|
||||
void set_scaled_for_first_image(bool val) { m_scaled_for_first_image = val; }
|
||||
|
||||
void clear();
|
||||
void flip(Gfx::Orientation);
|
||||
|
@ -73,6 +75,7 @@ private:
|
|||
|
||||
int m_scale { -1 };
|
||||
int m_toolbar_height { 28 };
|
||||
bool m_scaled_for_first_image { false };
|
||||
Gfx::FloatPoint m_pan_origin;
|
||||
Gfx::IntPoint m_click_position;
|
||||
Gfx::FloatPoint m_saved_pan_origin;
|
||||
|
|
|
@ -92,7 +92,8 @@ int main(int argc, char** argv)
|
|||
if (window->is_maximized())
|
||||
return;
|
||||
|
||||
if (scale == 100) {
|
||||
if (scale == 100 && !widget.scaled_for_first_image()) {
|
||||
widget.set_scaled_for_first_image(true);
|
||||
auto w = min(GUI::Desktop::the().rect().width(), rect.width() + 4);
|
||||
auto h = min(GUI::Desktop::the().rect().height(), rect.height() + widget.toolbar_height() + 6);
|
||||
window->resize(w, h);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue