summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-02-27 17:19:01 +0100
committerGitHub <noreply@github.com>2019-02-27 17:19:01 +0100
commitce615c1a828db38864b5eec5854376e745e5617e (patch)
tree21218fed522083e2b68565ed13e73e2a5e807708 /scene
parenteb2b9b88a965ee4b2647680d93bb931626376597 (diff)
parenta7b564db6e3f6e0f761e65671d3452e59f428898 (diff)
Merge pull request #26352 from bojidar-bg/21633-progress-stylebox
Fix minimum size of ProgressBar-s
Diffstat (limited to 'scene')
-rw-r--r--scene/gui/progress_bar.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp
index 2195ec9778..264eda4035 100644
--- a/scene/gui/progress_bar.cpp
+++ b/scene/gui/progress_bar.cpp
@@ -39,9 +39,12 @@ Size2 ProgressBar::get_minimum_size() const {
Size2 minimum_size = bg->get_minimum_size();
minimum_size.height = MAX(minimum_size.height, fg->get_minimum_size().height);
minimum_size.width = MAX(minimum_size.width, fg->get_minimum_size().width);
- //if (percent_visible) { this is needed, else the progressbar will collapse
- minimum_size.height = MAX(minimum_size.height, bg->get_minimum_size().height + font->get_height());
- //}
+ if (percent_visible) {
+ minimum_size.height = MAX(minimum_size.height, bg->get_minimum_size().height + font->get_height());
+ } else { // this is needed, else the progressbar will collapse
+ minimum_size.width = MAX(minimum_size.width, 1);
+ minimum_size.height = MAX(minimum_size.height, 1);
+ }
return minimum_size;
}