Skip to content

Commit

Permalink
Merge pull request #91997 from aaronp64/tooltip_transforms
Browse files Browse the repository at this point in the history
Fix tooltip mouse position conversion for scaled controls
  • Loading branch information
akien-mga committed Jun 10, 2024
2 parents 553f776 + aa07828 commit b7ea841
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scene/main/viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit b7ea841

Please sign in to comment.