-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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 Tree Mouse hover position #102842
Fix Tree Mouse hover position #102842
Conversation
a638f3e
to
73051b0
Compare
It seems I missed little detail, in the editor Scene Tree, it's still off a couple pixels... I'll debug that... |
198b143
to
5cce311
Compare
I fixed the issue by reusing the But, I found out an other issue that the last button is considered hovered and is clicable from the margin around the scrollbar: godot.windows.editor.dev.x86_64_r9luWwhb0f.mp4I tested in Godot 4.3 stable and turns out that this behaviour existed in the version (minus the hover which did not exist in 4.3): Godot_v4.3-stable_win64_HidwuJOb22.mp4I fixed it anyway by adding a check for the position vs the content area ( Now: godot.windows.editor.dev.x86_64_ZEPYRrybhU.mp4 |
The original bug is still there: godot.windows.editor.dev.x86_64_9tO5cv0WFE.mp4Different buttons are hovered and clicked. |
40b77dd
to
ecc4af4
Compare
Indeed, there's was still some difference between To prevent any difference between the two, I moved the commun parts in a new method called |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works correctly now.
ecc4af4
to
26cbaca
Compare
Thanks! |
This PR should fixes the hovered, tooltip and click position for trees button.
The PR includes:
_determine_hovered_item
to use the_find_button_at_pos
method which tried to do exactly the same thing, aka finding the button at a position.scrollbar_h_separation
but there's some calculations in_get_content_rect
that manage a situation where the scrollbar is inside the panel margin (when themescrollbar_margin_right
is >= 0). I simply used_get_content_rect
directly like a lot of other places in the tree code. This fix was added in_range_click_timeout
,gui_input
, and_find_button_at_pos
._find_button_at_pos
andpropagate_mouse_event
.pos.x
in_find_button_at_pos
causing an offset of a couple of pixels in RTL mode._find_button_at_pos
to have the exact position. Ex: If the position is 99,0 and the size is 100,0 the actual position to use is 0,0. If the position is 0,0, the actual position to use is 99,0. I changed every place in the Tree code where these adjustments were present.I tested in Window with the MRP from the issue and with different settings. I'm not familiar with the Tree control so I strongly suggest more test are done.
Note: There still some duplicate code between
_find_button_at_pos
andpropagate_mouse_event
but everything seems to work fine as is, I'm really not confident I can refactor this without any side effect, especially just before a new release.godot.windows.editor.dev.x86_64_3rOzMy9UvI.mp4