Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tooltip mouse position conversion for scaled controls #91997

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

aaronp64
Copy link
Contributor

Viewport used get_global_transform().xform_inv(mpos) to convert the mouse position to the control's local coordinates when getting the control's tooltip, which does not handle scale correctly. This impacted tooltips for any controls that depended on the position to determine what tooltip to show, including RichTextLabel, ItemList, Tree, and probably some others. This change is for Viewport to use get_global_transform_with_canvas().affine_inverse().xform(mpos) for tooltips instead, to match what we do for Viewport::_gui_call_input.

Fixes #91984

Viewport used get_global_transform().xform_inv(mpos) to convert the mouse position to the control's local coordinates when getting the control's tooltip, which does not handle scale correctly.  This impacted tooltips for any controls that depended on the position to determine what tooltip to show, including RichTextLabel, ItemList, Tree, and probably some others.  This change is for Viewport to use get_global_transform_with_canvas().affine_inverse().xform(mpos) for tooltips instead, to match what we do for Viewport::_gui_call_input.

Fixes godotengine#91984
@aaronp64 aaronp64 requested a review from a team as a code owner May 15, 2024 21:32
@Calinou Calinou added bug topic:gui cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release labels May 16, 2024
@Calinou Calinou added this to the 4.3 milestone May 16, 2024
@Sauermann Sauermann assigned Sauermann and unassigned Sauermann May 16, 2024
@Sauermann Sauermann self-requested a review May 16, 2024 05:43
@emirljuca
Copy link

Hey can this be looked at again?

@emirljuca
Copy link

Bump

Copy link
Member

@Calinou Calinou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally, it works as expected.

Testing project: RichTextLabelHintTestGdscript.zip
(This is the MRP from #91984 converted to GDScript, so you don't need a C# build to run it.)

Before

tooltip_before.mp4

After (this PR)

tooltip_after.mp4

@akien-mga akien-mga merged commit b7ea841 into godotengine:master Jun 10, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@aaronp64 aaronp64 deleted the tooltip_transforms branch June 28, 2024 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug cherrypick:4.2 Considered for cherry-picking into a future 4.2.x release topic:gui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scaling RichTextLabel does not update hint tooltip text popup location
5 participants