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

Tree button click detection is off #102194

Open
Giganzo opened this issue Jan 30, 2025 · 4 comments
Open

Tree button click detection is off #102194

Giganzo opened this issue Jan 30, 2025 · 4 comments

Comments

@Giganzo
Copy link
Contributor

Giganzo commented Jan 30, 2025

Tested versions

Godot v4.4.beta2

System information

Fedora Linux 40 (KDE Plasma) on Wayland - X11 display driver, Multi-window

Issue description

Tree button click detection is off.
Mouse is over one button but you click on another.
In some cases it draws hover state for one button but clicks on another.

Screencast_20250130_143844.webm

Steps to reproduce

Have multiple buttons in a column.
Try to interact with them.

Minimal reproduction project (MRP)

treemouse.zip

@AThousandShips
Copy link
Member

AThousandShips commented Jan 30, 2025

Seems like this is a broken feature from the start, introduced in #88530

Will confirm that it was broken from the first commit once I've compiled it

Edit: Was the same way from the start, so some computation in the PR was incorrect

CC @davthedev

@Giganzo
Copy link
Contributor Author

Giganzo commented Jan 30, 2025

The other thing that makes the click fell off, is that it applies margin only on the right side of the button. Is this the correct behavior?

From 4.3

Screencast_20250130_162735.webm

@davthedev
Copy link
Contributor

There is something to refactor in this big widget, in order to bring the hover & click detection to the same logic.

What you see is because there is one legacy, yet complex algorithm to compute clicks that was there before, and I added a simpler algorithm to compute hover position updates in order to limit possible side effects. I have not merged both algorithms yet, which should be done at some point.

Thank you for bringing those corner cases to my attention. The second one is mysterious, would be because of the horizontal scrolling?

I do not have the time to look at it right now, health being in the way at the moment. But I will check it out later.

@Giganzo
Copy link
Contributor Author

Giganzo commented Jan 30, 2025

Thank you for bringing those corner cases to my attention. The second one is mysterious, would be because of the horizontal scrolling?

Yes that looks to be the case.

I made a PR for get_item_area_rect and scrolling, #102116. Maybe something can be used from that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Bad
Development

No branches or pull requests

3 participants