mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
include parent display location in popup location calculation
This commit is contained in:
parent
918f03529f
commit
5a507df255
@ -983,7 +983,7 @@ 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.size - popup_rect.size) / 2;
|
||||
popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
|
||||
|
||||
popup(popup_rect);
|
||||
}
|
||||
@ -1009,7 +1009,7 @@ void Window::popup_centered(const Size2i &p_minsize) {
|
||||
} else {
|
||||
popup_rect.size = p_minsize;
|
||||
}
|
||||
popup_rect.position = (parent_rect.size - popup_rect.size) / 2;
|
||||
popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
|
||||
|
||||
popup(popup_rect);
|
||||
}
|
||||
@ -1031,7 +1031,7 @@ void Window::popup_centered_ratio(float p_ratio) {
|
||||
|
||||
Rect2i popup_rect;
|
||||
popup_rect.size = parent_rect.size * p_ratio;
|
||||
popup_rect.position = (parent_rect.size - popup_rect.size) / 2;
|
||||
popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
|
||||
|
||||
popup(popup_rect);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user