diff options
author | Cykyrios <cykyrios@gmail.com> | 2022-10-07 19:14:41 +0200 |
---|---|---|
committer | Cykyrios <cykyrios@gmail.com> | 2022-10-07 22:43:49 +0200 |
commit | f0d793405568f9a4dd052d45ccbf8b168fe82019 (patch) | |
tree | 69a06a96e32c9428c6acb903b23f73429c1ade46 /scene/main | |
parent | 1baefceababe8a0d63434a231c3799555a45d8e3 (diff) |
Fix invalid tooltip position
Diffstat (limited to 'scene/main')
-rw-r--r-- | scene/main/viewport.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/main/viewport.cpp b/scene/main/viewport.cpp index f7a515dc1d..1f90f4a848 100644 --- a/scene/main/viewport.cpp +++ b/scene/main/viewport.cpp @@ -1265,7 +1265,12 @@ void Viewport::_gui_show_tooltip() { Rect2 r(gui.tooltip_pos + tooltip_offset, gui.tooltip_popup->get_contents_minimum_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. |