1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-18 14:21:41 +00:00

Disable tooltip fitting if FEATURE_SELF_FITTING_WINDOWS is available

This commit is contained in:
Dery Almas
2025-07-14 15:18:21 +02:00
parent 98537b2e0c
commit cf48f5a102
2 changed files with 34 additions and 30 deletions

View File

@@ -4655,6 +4655,7 @@ void EditorHelpBitTooltip::popup_under_cursor() {
vr = window->get_usable_parent_rect(); vr = window->get_usable_parent_rect();
} }
if (!DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_SELF_FITTING_WINDOWS) || is_embedded()) {
if (r.size.x + r.position.x > vr.size.x + vr.position.x) { 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. // Place it in the opposite direction. If it fails, just hug the border.
r.position.x = mouse_pos.x - r.size.x - tooltip_offset.x; r.position.x = mouse_pos.x - r.size.x - tooltip_offset.x;
@@ -4676,6 +4677,7 @@ void EditorHelpBitTooltip::popup_under_cursor() {
} else if (r.position.y < vr.position.y) { } else if (r.position.y < vr.position.y) {
r.position.y = vr.position.y; r.position.y = vr.position.y;
} }
}
// When `FLAG_POPUP` is false, it prevents the editor from losing focus when displaying the tooltip. // When `FLAG_POPUP` is false, it prevents the editor from losing focus when displaying the tooltip.
// This way, clicks and double-clicks are still available outside the tooltip. // This way, clicks and double-clicks are still available outside the tooltip.

View File

@@ -1678,6 +1678,7 @@ void Viewport::_gui_show_tooltip_at(const Point2i &p_pos) {
r.size = r.size.ceil(); r.size = r.size.ceil();
r.size = r.size.min(panel->get_max_size()); r.size = r.size.min(panel->get_max_size());
if (!DisplayServer::get_singleton()->has_feature(DisplayServer::FEATURE_SELF_FITTING_WINDOWS) || gui.tooltip_popup->is_embedded()) {
if (r.size.x + r.position.x > vr.size.x + vr.position.x) { 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. // Place it in the opposite direction. If it fails, just hug the border.
r.position.x = gui.tooltip_pos.x - r.size.x - tooltip_offset.x; r.position.x = gui.tooltip_pos.x - r.size.x - tooltip_offset.x;
@@ -1699,6 +1700,7 @@ void Viewport::_gui_show_tooltip_at(const Point2i &p_pos) {
} else if (r.position.y < vr.position.y) { } else if (r.position.y < vr.position.y) {
r.position.y = vr.position.y; r.position.y = vr.position.y;
} }
}
DisplayServer::WindowID active_popup = DisplayServer::get_singleton()->window_get_active_popup(); DisplayServer::WindowID active_popup = DisplayServer::get_singleton()->window_get_active_popup();
if (active_popup == DisplayServer::INVALID_WINDOW_ID || active_popup == window->get_window_id()) { if (active_popup == DisplayServer::INVALID_WINDOW_ID || active_popup == window->get_window_id()) {