Merge pull request #45509 from KoBeWi/scaled_poop

Fix popup_centered() for scaled popups
This commit is contained in:
Rémi Verschelde 2021-01-27 19:02:18 +01:00 committed by GitHub
commit 7595228794
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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