-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
UI Text picking #17775
base: main
Are you sure you want to change the base?
UI Text picking #17775
Conversation
The generated |
I'm merging #17681; can you update this PR to use that? :) |
Yeah absolutely, thanks :) |
And I'm merging #17748, which will create some more merge conflicts for you <3 |
interesting. |
Yeah it's possible with some APIs in this PR, this is very work-in-progress at the moment so I wouldn't rely on anything here being available in bevy any time soon if at all, but everything I've implemented should be possible in third party space. Getting the |
I think I'll refocus this PR to just UI text picking, once all the kinks are done there I'll have another look at Text2d, code changes getting a bit heavy |
Objective
Add text picking backends.
Fixes #17477 + fixes #17706
Solution
Write a backend that emits text specific pointer events for UI text.
Testing
examples/picking/text_picking.rs
Next steps
More visual example, perhaps showing selectable text showcasing dragging observers.
Performance concerns: Iterating every glyph on every hover event is a LOT of iterating. Maybe leave getting a
PositionedGlyph
from aCursor
up to a helper functionFix window scale factor issues
Consider fully decoupling from
Pointer
, Like read PointerHits directly, or even create a separateTextPointerHits
channel. Lots of duplicated functionality though.Showcase
Currently returns a cosmic
Cursor
in a newTextPointer
event that can be used in observers similar toPointer
events.