diff options
| author | Juan Linietsky | 2018-05-07 16:33:12 -0300 |
|---|---|---|
| committer | GitHub | 2018-05-07 16:33:12 -0300 |
| commit | 2ba8b5b27c8c2a0a01eca5aa2db0e60870ff1668 (patch) | |
| tree | 236605ac357a4705d38d588193c4ce7630af9e9c | |
| parent | 3051bb8a81858b3cbb26f760e572a44a8668c155 (diff) | |
| parent | 91eb80041d588ef22926422ae2fc39f375e11aec (diff) | |
| download | godot-2ba8b5b27c8c2a0a01eca5aa2db0e60870ff1668.tar.gz godot-2ba8b5b27c8c2a0a01eca5aa2db0e60870ff1668.tar.zst godot-2ba8b5b27c8c2a0a01eca5aa2db0e60870ff1668.zip | |
| -rw-r--r-- | scene/gui/progress_bar.cpp | 9 | ||||
| -rw-r--r-- | scene/resources/style_box.cpp | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/scene/gui/progress_bar.cpp b/scene/gui/progress_bar.cpp index c85bed045..37e519e37 100644 --- a/scene/gui/progress_bar.cpp +++ b/scene/gui/progress_bar.cpp @@ -33,13 +33,16 @@ Size2 ProgressBar::get_minimum_size() const { Ref<StyleBox> bg = get_stylebox("bg"); + Ref<StyleBox> fg = get_stylebox("fg"); Ref<Font> font = get_font("font"); - Size2 ms = bg->get_minimum_size() + bg->get_center_size(); + 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) { - ms.height = MAX(ms.height, bg->get_minimum_size().height + font->get_height()); + minimum_size.height = MAX(minimum_size.height, bg->get_minimum_size().height + font->get_height()); } - return ms; + return minimum_size; } void ProgressBar::_notification(int p_what) { diff --git a/scene/resources/style_box.cpp b/scene/resources/style_box.cpp index ad5a0fd9a..7da65ac98 100644 --- a/scene/resources/style_box.cpp +++ b/scene/resources/style_box.cpp @@ -186,7 +186,7 @@ Size2 StyleBoxTexture::get_center_size() const { if (texture.is_null()) return Size2(); - return texture->get_size() - get_minimum_size(); + return region_rect.size - get_minimum_size(); } void StyleBoxTexture::set_expand_margin_size(Margin p_expand_margin, float p_size) { |
