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

Improve hit-test of thin widgets, and widgets across layers #5468

Merged
merged 10 commits into from
Dec 16, 2024

Conversation

emilk
Copy link
Owner

@emilk emilk commented Dec 12, 2024

When there are multiple layers (e.g. with custom transforms) close to each other, the hit test code used to only consider widgets in the layer directly under the mouse. This can make it difficult to hit thin widgets just on the outside of a transform layer.

This PR fixes that.

It also prioritizes thin widgets, so that if there is both a thin widget and a thick widget under the mouse cursor, you will always hit the thin widgets, even if the thin widgets is layered behind the thick one. This makes it easier to hit thin resize-handles.

In theory this should allow us to make resize_grab_radius_side and resize_grab_radius_corner smaller in a future PR, if we want to.

@emilk emilk added the egui label Dec 12, 2024
Copy link

Preview available at https://egui-pr-preview.github.io/pr/5468-emilkimprove-cross-layer-hit-test
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@emilk emilk changed the title Improve cross-layer hit test Improve hit-test of thin widgets, and widgets across layers Dec 13, 2024
@emilk emilk marked this pull request as ready for review December 13, 2024 07:13
@emilk emilk marked this pull request as draft December 13, 2024 07:20
@emilk emilk marked this pull request as ready for review December 13, 2024 08:17
@emilk emilk merged commit f7efb21 into master Dec 16, 2024
46 checks passed
@emilk emilk deleted the emilk/improve-cross-layer-hit-test branch December 16, 2024 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant