mirror of
https://github.com/godotengine/godot.git
synced 2025-10-29 12:44:31 +00:00
Fix Embedded Game window wrong first startup location and size
This commit is contained in:
parent
8ed125b429
commit
068d40a5a9
3 changed files with 26 additions and 10 deletions
|
|
@ -95,9 +95,11 @@ void EmbeddedProcess::set_keep_aspect(bool p_keep_aspect) {
|
|||
}
|
||||
}
|
||||
|
||||
Rect2i EmbeddedProcess::_get_global_embedded_window_rect() {
|
||||
Rect2i control_rect = get_global_rect();
|
||||
control_rect = Rect2i(control_rect.position + margin_top_left, (control_rect.size - get_margins_size()).maxi(1));
|
||||
Rect2i EmbeddedProcess::get_adjusted_embedded_window_rect(Rect2i p_rect) {
|
||||
Rect2i control_rect = Rect2i(p_rect.position + margin_top_left, (p_rect.size - get_margins_size()).maxi(1));
|
||||
if (window) {
|
||||
control_rect.position += window->get_position();
|
||||
}
|
||||
if (window_size != Size2i()) {
|
||||
Rect2i desired_rect = Rect2i();
|
||||
if (!keep_aspect && control_rect.size.x >= window_size.x && control_rect.size.y >= window_size.y) {
|
||||
|
|
@ -116,12 +118,7 @@ Rect2i EmbeddedProcess::_get_global_embedded_window_rect() {
|
|||
}
|
||||
|
||||
Rect2i EmbeddedProcess::get_screen_embedded_window_rect() {
|
||||
Rect2i rect = _get_global_embedded_window_rect();
|
||||
if (window) {
|
||||
rect.position += window->get_position();
|
||||
}
|
||||
|
||||
return rect;
|
||||
return get_adjusted_embedded_window_rect(get_global_rect());
|
||||
}
|
||||
|
||||
int EmbeddedProcess::get_margin_size(Side p_side) const {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue