Merge pull request #91997 from aaronp64/tooltip_transforms

Fix tooltip mouse position conversion for scaled controls
This commit is contained in:
Rémi Verschelde 2024-06-10 16:11:39 +02:00
commit b7ea8415c2
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -1430,7 +1430,7 @@ void Viewport::_gui_show_tooltip() {
Control *tooltip_owner = nullptr;
gui.tooltip_text = _gui_get_tooltip(
gui.tooltip_control,
gui.tooltip_control->get_global_transform().xform_inv(gui.last_mouse_pos),
gui.tooltip_control->get_global_transform_with_canvas().affine_inverse().xform(gui.last_mouse_pos),
&tooltip_owner);
gui.tooltip_text = gui.tooltip_text.strip_edges();
@ -1910,7 +1910,7 @@ void Viewport::_gui_input_event(Ref<InputEvent> p_event) {
if (gui.tooltip_popup) {
if (gui.tooltip_control) {
String tooltip = _gui_get_tooltip(over, gui.tooltip_control->get_global_transform().xform_inv(mpos));
String tooltip = _gui_get_tooltip(over, gui.tooltip_control->get_global_transform_with_canvas().affine_inverse().xform(mpos));
tooltip = tooltip.strip_edges();
if (tooltip.is_empty() || tooltip != gui.tooltip_text) {