Merge pull request #45509 from KoBeWi/scaled_poop
Fix popup_centered() for scaled popups
This commit is contained in:
commit
7595228794
1 changed files with 2 additions and 2 deletions
|
@ -147,7 +147,7 @@ void Popup::popup_centered(const Size2 &p_size) {
|
||||||
Rect2 rect;
|
Rect2 rect;
|
||||||
Size2 window_size = get_viewport_rect().size;
|
Size2 window_size = get_viewport_rect().size;
|
||||||
rect.size = p_size == Size2() ? get_size() : p_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);
|
_popup(rect, true);
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ void Popup::popup_centered_ratio(float p_screen_ratio) {
|
||||||
Rect2 rect;
|
Rect2 rect;
|
||||||
Size2 window_size = get_viewport_rect().size;
|
Size2 window_size = get_viewport_rect().size;
|
||||||
rect.size = (window_size * p_screen_ratio).floor();
|
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);
|
_popup(rect, true);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue