Merge pull request #17828 from bojidar-bg/17779-progressbar-minimum-size
Fix StyleBox ignoring region rect and ProgressBar using center size
This commit is contained in:
commit
2ba8b5b27c
2 changed files with 7 additions and 4 deletions
|
@ -33,13 +33,16 @@
|
||||||
Size2 ProgressBar::get_minimum_size() const {
|
Size2 ProgressBar::get_minimum_size() const {
|
||||||
|
|
||||||
Ref<StyleBox> bg = get_stylebox("bg");
|
Ref<StyleBox> bg = get_stylebox("bg");
|
||||||
|
Ref<StyleBox> fg = get_stylebox("fg");
|
||||||
Ref<Font> font = get_font("font");
|
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) {
|
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) {
|
void ProgressBar::_notification(int p_what) {
|
||||||
|
|
|
@ -186,7 +186,7 @@ Size2 StyleBoxTexture::get_center_size() const {
|
||||||
if (texture.is_null())
|
if (texture.is_null())
|
||||||
return Size2();
|
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) {
|
void StyleBoxTexture::set_expand_margin_size(Margin p_expand_margin, float p_size) {
|
||||||
|
|
Loading…
Reference in a new issue