Clamp ratio from popup_centered_ratio

This commit is contained in:
Ev1lbl0w 2021-10-24 16:27:08 +01:00
parent 80801e5f66
commit 139c1eb655
No known key found for this signature in database
GPG Key ID: B383693E3746E58A

View File

@ -1025,6 +1025,7 @@ void Window::popup_centered(const Size2i &p_minsize) {
void Window::popup_centered_ratio(float p_ratio) {
ERR_FAIL_COND(!is_inside_tree());
ERR_FAIL_COND_MSG(window_id == DisplayServer::MAIN_WINDOW_ID, "Can't popup the main window.");
ERR_FAIL_COND_MSG(p_ratio <= 0.0 || p_ratio > 1.0, "Ratio must be between 0.0 and 1.0!");
Rect2 parent_rect;