summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-04-27 09:33:40 +0200
committerGitHub <noreply@github.com>2022-04-27 09:33:40 +0200
commita19d7d8f8d1c82e8dcd2bff4cb2f7fb3a9c9862e (patch)
tree23bfa0768928b8715844442c3ae84ddfae6adc43 /scene
parent03ac4da27fc91e43d0f678046f98f80656f26a6c (diff)
parentdefcd0c57e8b90177639963e958ea91be4c511bc (diff)
Merge pull request #58383 from bruvzg/no_inv_window_placement
Diffstat (limited to 'scene')
-rw-r--r--scene/main/window.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/scene/main/window.cpp b/scene/main/window.cpp
index 8b1a4680d2..6feccb7eec 100644
--- a/scene/main/window.cpp
+++ b/scene/main/window.cpp
@@ -1045,7 +1045,9 @@ void Window::popup_centered_clamped(const Size2i &p_size, float p_fallback_ratio
Rect2i popup_rect;
popup_rect.size = Vector2i(MIN(size_ratio.x, p_size.x), MIN(size_ratio.y, p_size.y));
- popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
+ if (parent_rect != Rect2()) {
+ popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
+ }
popup(popup_rect);
}
@@ -1069,7 +1071,10 @@ void Window::popup_centered(const Size2i &p_minsize) {
Size2 contents_minsize = _get_contents_minimum_size();
popup_rect.size.x = MAX(p_minsize.x, contents_minsize.x);
popup_rect.size.y = MAX(p_minsize.y, contents_minsize.y);
- popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
+
+ if (parent_rect != Rect2()) {
+ popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
+ }
popup(popup_rect);
}
@@ -1091,8 +1096,10 @@ void Window::popup_centered_ratio(float p_ratio) {
}
Rect2i popup_rect;
- popup_rect.size = parent_rect.size * p_ratio;
- popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
+ if (parent_rect != Rect2()) {
+ popup_rect.size = parent_rect.size * p_ratio;
+ popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
+ }
popup(popup_rect);
}