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

Allow for click detection (mouse picking) of a TextSpan #17477

Open
ethereumdegen opened this issue Jan 21, 2025 · 2 comments
Open

Allow for click detection (mouse picking) of a TextSpan #17477

ethereumdegen opened this issue Jan 21, 2025 · 2 comments
Labels
A-Picking Pointing at and selecting objects of all sorts A-Text Rendering and layout for characters C-Feature A new feature, making something new possible D-Complex Quite challenging from either a design or technical perspective. Ask for help! S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Uncontroversial This work is generally agreed upon

Comments

@ethereumdegen
Copy link
Contributor

ethereumdegen commented Jan 21, 2025

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

I am rendering a Text element with many child TextNodes , some of the children are 'links' so they have a component on them that has the destination when clicked. However, it seems that the Interaction component doesnt work with a TextSpan in 0.15 . ?

What solution would you like?

Some way, with Interaction or otherwise, to be able to detect a click (trigger on an entity on mouse click) on a text span

I have tried to attach a Node and Button component to the text span but that totally breaks the text rendering.

@ethereumdegen ethereumdegen added C-Feature A new feature, making something new possible S-Needs-Triage This issue needs to be labelled labels Jan 21, 2025
@alice-i-cecile alice-i-cecile added A-Text Rendering and layout for characters 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! X-Uncontroversial This work is generally agreed upon D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes D-Complex Quite challenging from either a design or technical perspective. Ask for help! and removed S-Needs-Triage This issue needs to be labelled D-Modest A "normal" level of difficulty; suitable for simple features or challenging fixes labels Jan 21, 2025
@alice-i-cecile
Copy link
Member

This needs a text picking backend :)

@ethereumdegen
Copy link
Contributor Author

Ickshonope says this is a potential way to impl it

"

It isn't too hard, once you detect a click on the UI node containing the text you just need to take the mouse position and then iterate through all the positioned glyphs in TextLayoutInfo and find which glyph the cursor was over and then you get the span index from that PositionedGlyph

"

But there may be a few different approaches possible as far as an in-engine soln -

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-Text Rendering and layout for characters C-Feature A new feature, making something new possible D-Complex Quite challenging from either a design or technical perspective. Ask for help! S-Ready-For-Implementation This issue is ready for an implementation PR. Go for it! X-Uncontroversial This work is generally agreed upon
Projects
None yet
Development

No branches or pull requests

2 participants