Browse Source

Merge pull request #41776 from EricEzaM/PR/tooltip-bugfixes

Tooltip flickering and targeting fixes.
Rémi Verschelde 5 years ago
parent
commit
6f0fa8519f
2 changed files with 2 additions and 2 deletions
  1. 1 1
      scene/gui/base_button.cpp
  2. 1 1
      scene/main/viewport.cpp

+ 1 - 1
scene/gui/base_button.cpp

@@ -345,7 +345,7 @@ String BaseButton::get_tooltip(const Point2 &p_pos) const {
 	String tooltip = Control::get_tooltip(p_pos);
 	String tooltip = Control::get_tooltip(p_pos);
 	if (shortcut_in_tooltip && shortcut.is_valid() && shortcut->is_valid()) {
 	if (shortcut_in_tooltip && shortcut.is_valid() && shortcut->is_valid()) {
 		String text = shortcut->get_name() + " (" + shortcut->get_as_text() + ")";
 		String text = shortcut->get_name() + " (" + shortcut->get_as_text() + ")";
-		if (shortcut->get_name().nocasecmp_to(tooltip) != 0) {
+		if (tooltip != String() && shortcut->get_name().nocasecmp_to(tooltip) != 0) {
 			text += "\n" + tooltip;
 			text += "\n" + tooltip;
 		}
 		}
 		tooltip = text;
 		tooltip = text;

+ 1 - 1
scene/main/viewport.cpp

@@ -1509,7 +1509,7 @@ void Viewport::_gui_show_tooltip() {
 	}
 	}
 
 
 	Control *which = nullptr;
 	Control *which = nullptr;
-	String tooltip = _gui_get_tooltip(gui.tooltip, gui.tooltip->get_global_transform().xform_inv(gui.tooltip_pos), &which);
+	String tooltip = _gui_get_tooltip(gui.tooltip, gui.tooltip->get_global_transform().xform_inv(gui.last_mouse_pos), &which);
 	tooltip = tooltip.strip_edges();
 	tooltip = tooltip.strip_edges();
 	if (tooltip.length() == 0) {
 	if (tooltip.length() == 0) {
 		return; // bye
 		return; // bye