mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Use Vector* component-wise min/max/clamp functions where applicable
This commit is contained in:
@@ -35,15 +35,13 @@
|
||||
|
||||
Size2 ProgressBar::get_minimum_size() const {
|
||||
Size2 minimum_size = theme_cache.background_style->get_minimum_size();
|
||||
minimum_size.height = MAX(minimum_size.height, theme_cache.fill_style->get_minimum_size().height);
|
||||
minimum_size.width = MAX(minimum_size.width, theme_cache.fill_style->get_minimum_size().width);
|
||||
minimum_size = minimum_size.max(theme_cache.fill_style->get_minimum_size());
|
||||
if (show_percentage) {
|
||||
String txt = "100%";
|
||||
TextLine tl = TextLine(txt, theme_cache.font, theme_cache.font_size);
|
||||
minimum_size.height = MAX(minimum_size.height, theme_cache.background_style->get_minimum_size().height + tl.get_size().y);
|
||||
} 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);
|
||||
minimum_size = minimum_size.max(Size2(1, 1));
|
||||
}
|
||||
return minimum_size;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user