include parent display location in popup location calculation

This commit is contained in:
Mark Riedesel 2020-10-21 12:57:56 -04:00
parent 918f03529f
commit 5a507df255

View File

@ -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);
}