Skip to content

Commit

Permalink
Fix ButtonSet widget with icons resizing when UIScale is changed
Browse files Browse the repository at this point in the history
  • Loading branch information
Gasparoken committed Jun 29, 2023
1 parent a628bbb commit 9c3a6d0
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/ui/theme.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Aseprite UI Library
// Copyright (C) 2019-2022 Igara Studio S.A.
// Copyright (C) 2019-2023 Igara Studio S.A.
// Copyright (C) 2001-2018 David Capello
//
// This file is released under the terms of the MIT license.
Expand Down Expand Up @@ -685,8 +685,10 @@ gfx::Size Theme::calcMinSize(const Widget* widget,

gfx::Size sz = widget->minSize();

if (sz.w == 0) sz.w = style->minSize().w;
if (sz.h == 0) sz.h = style->minSize().h;
if (sz.w == 0 || style->minSize().w > 0)
sz.w = style->minSize().w;
if (sz.h == 0 || style->minSize().h > 0)
sz.h = style->minSize().h;

return sz;
}
Expand All @@ -699,8 +701,11 @@ gfx::Size Theme::calcMaxSize(const Widget* widget,

gfx::Size sz = widget->maxSize();

if (sz.w == std::numeric_limits<int>::max()) sz.w = style->maxSize().w;
if (sz.h == std::numeric_limits<int>::max()) sz.h = style->maxSize().h;
int maxInt = std::numeric_limits<int>::max();
if (sz.w == maxInt || style->maxSize().w < maxInt)
sz.w = style->maxSize().w;
if (sz.h == maxInt || style->maxSize().h < maxInt)
sz.h = style->maxSize().h;

return sz;
}
Expand Down

0 comments on commit 9c3a6d0

Please sign in to comment.