Merge pull request #67046 from Cykyrios/fix-invalid-tooltip-position

Fix invalid tooltip position
This commit is contained in:
Rémi Verschelde 2022-10-31 11:05:19 +01:00
commit dcd86f9848
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -1266,7 +1266,12 @@ void Viewport::_gui_show_tooltip() {
r.size = r.size.min(panel->get_max_size());
Window *window = gui.tooltip_popup->get_parent_visible_window();
Rect2i vr = window->get_usable_parent_rect();
Rect2i vr;
if (gui.tooltip_popup->is_embedded()) {
vr = gui.tooltip_popup->_get_embedder()->get_visible_rect();
} else {
vr = window->get_usable_parent_rect();
}
if (r.size.x + r.position.x > vr.size.x + vr.position.x) {
// Place it in the opposite direction. If it fails, just hug the border.