Skip to content

Add optional alpha / transparency passthrough for UI picking backend #17448

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

Open
mgi388 opened this issue Jan 20, 2025 · 0 comments
Open

Add optional alpha / transparency passthrough for UI picking backend #17448

mgi388 opened this issue Jan 20, 2025 · 0 comments
Labels
A-Picking Pointing at and selecting objects of all sorts A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!

Comments

@mgi388
Copy link
Contributor

mgi388 commented Jan 20, 2025

What problem does this solve or what need does it fill?

Optional transparency passthrough was added to the sprite picking backend in #16388.

What solution would you like?

  • I'd like to have the same capability for the UI picking backend. I have some decorative UI panels and I'd like avoid picking triggering when hovering their transparent areas.
  • This was also hinted at in Don't count picking hits on button rounded corners #14941 (comment) but perhaps we forgot to add a tracking issue.
  • As a bonus: Pending blessing, I'd consider the implementer doing a per-entity solution from day 1, so that you can mark some entities as using the alpha threshold, while others just inherit the global resource. If I had to guess, it doesn't seem much work adding that at the same time, but time will tell.
  • Implementation to be verified but maybe spawning an entity with per-entity picking settings would look like this:
commands.spawn((
    Node {
        // ...
        ..Default::default()
    },
    ImageNode {
        // ...
        ..Default::default()
    },
    ImagePickingSettings { picking_mode: ImagePickingMode::BoundingBox },
));
  • Noting that, for the sprite picking backend, SpritePickingSettings defaults to { picking_mode: SpritePickingMode::AlphaThreshold(0.1) } and so the example here is to illustrate that this entity is overriding the OOTB alpha-threshold check to instead use a bounding-box check.

What alternative(s) have you considered?

If you just have rounded buttons maybe #14957 already works for you, but it doesn't in my case.

@mgi388 mgi388 added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 20, 2025
@alice-i-cecile alice-i-cecile added A-UI Graphical user interfaces, styles, layouts, and widgets A-Picking Pointing at and selecting objects of all sorts S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! and removed S-Needs-Triage This issue needs to be labelled labels Jan 20, 2025
@BenjaminBrienen BenjaminBrienen added the D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Picking Pointing at and selecting objects of all sorts A-UI Graphical user interfaces, styles, layouts, and widgets C-Feature A new feature, making something new possible D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it!
Projects
None yet
Development

No branches or pull requests

3 participants