diff options
author | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-03-03 12:49:08 +0100 |
---|---|---|
committer | A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> | 2024-03-20 13:47:42 +0100 |
commit | 79ba22a73f238ebd110fc5f3744c3c12a9a59475 (patch) | |
tree | ff5d57ddb759c04297aa6482cdc389ca8bc0c2cf /scene/main/window.cpp | |
parent | fe01776f05b1787b28b4a270d53037a3c25f4ca2 (diff) | |
download | redot-engine-79ba22a73f238ebd110fc5f3744c3c12a9a59475.tar.gz |
Use `Vector*` component-wise `min/max/clamp` functions where applicable
Diffstat (limited to 'scene/main/window.cpp')
-rw-r--r-- | scene/main/window.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/scene/main/window.cpp b/scene/main/window.cpp index 6632dd9033..bced493d98 100644 --- a/scene/main/window.cpp +++ b/scene/main/window.cpp @@ -1033,8 +1033,7 @@ void Window::_update_window_size() { } if (embedder) { - size.x = MAX(size.x, 1); - size.y = MAX(size.y, 1); + size = size.max(Size2i(1, 1)); embedder->_sub_window_update(this); } else if (window_id != DisplayServer::INVALID_WINDOW_ID) { @@ -1545,8 +1544,7 @@ Size2 Window::_get_contents_minimum_size() const { Point2i pos = c->get_position(); Size2i min = c->get_combined_minimum_size(); - max.x = MAX(pos.x + min.x, max.x); - max.y = MAX(pos.y + min.y, max.y); + max = max.max(pos + min); } } @@ -1703,7 +1701,7 @@ void Window::popup_centered_clamped(const Size2i &p_size, float p_fallback_ratio Vector2i size_ratio = parent_rect.size * p_fallback_ratio; Rect2i popup_rect; - popup_rect.size = Vector2i(MIN(size_ratio.x, expected_size.x), MIN(size_ratio.y, expected_size.y)); + popup_rect.size = size_ratio.min(expected_size); popup_rect.size = _clamp_window_size(popup_rect.size); if (parent_rect != Rect2()) { |