Fix popup_centered() for scaled popups

This commit is contained in:
kobewi 2021-01-27 18:12:09 +01:00
parent 98666f9855
commit a7a490e650
1 changed files with 2 additions and 2 deletions

View File

@ -147,7 +147,7 @@ void Popup::popup_centered(const Size2 &p_size) {
Rect2 rect;
Size2 window_size = get_viewport_rect().size;
rect.size = p_size == Size2() ? get_size() : p_size;
rect.position = ((window_size - rect.size) / 2.0).floor();
rect.position = ((window_size - rect.size * get_scale()) / 2.0).floor();
_popup(rect, true);
}
@ -157,7 +157,7 @@ void Popup::popup_centered_ratio(float p_screen_ratio) {
Rect2 rect;
Size2 window_size = get_viewport_rect().size;
rect.size = (window_size * p_screen_ratio).floor();
rect.position = ((window_size - rect.size) / 2.0).floor();
rect.position = ((window_size - rect.size * get_scale()) / 2.0).floor();
_popup(rect, true);
}