Merge pull request #42969 from Klowner/fixes/42967-popup-position
include parent display location in popup location calculation
This commit is contained in:
commit
2de498d438
|
@ -983,7 +983,7 @@ void Window::popup_centered_clamped(const Size2i &p_size, float p_fallback_ratio
|
|||
|
||||
Rect2i popup_rect;
|
||||
popup_rect.size = Vector2i(MIN(size_ratio.x, p_size.x), MIN(size_ratio.y, p_size.y));
|
||||
popup_rect.position = (parent_rect.size - popup_rect.size) / 2;
|
||||
popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
|
||||
|
||||
popup(popup_rect);
|
||||
}
|
||||
|
@ -1009,7 +1009,7 @@ void Window::popup_centered(const Size2i &p_minsize) {
|
|||
} else {
|
||||
popup_rect.size = p_minsize;
|
||||
}
|
||||
popup_rect.position = (parent_rect.size - popup_rect.size) / 2;
|
||||
popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
|
||||
|
||||
popup(popup_rect);
|
||||
}
|
||||
|
@ -1031,7 +1031,7 @@ void Window::popup_centered_ratio(float p_ratio) {
|
|||
|
||||
Rect2i popup_rect;
|
||||
popup_rect.size = parent_rect.size * p_ratio;
|
||||
popup_rect.position = (parent_rect.size - popup_rect.size) / 2;
|
||||
popup_rect.position = parent_rect.position + (parent_rect.size - popup_rect.size) / 2;
|
||||
|
||||
popup(popup_rect);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue