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

Example of using getCaretAtPoint()/getSelectionRects() #71

Open
Utopiah opened this issue Mar 30, 2023 · 3 comments
Open

Example of using getCaretAtPoint()/getSelectionRects() #71

Utopiah opened this issue Mar 30, 2023 · 3 comments

Comments

@Utopiah
Copy link
Contributor

Utopiah commented Mar 30, 2023

I noticed https://protectwise.github.io/troika/troika-three-text/#carets-and-selection-ranges and as I'm tinkering with the idea of a minimalist Vim in WebXR thought it could help. Are these functions accessible somehow from the component?

@lojjic
Copy link
Owner

lojjic commented Mar 30, 2023

Hmm, those utility functions don't end up in the aframe-troika-text bundle.

I suppose you could copy the selectionUtils.js file directly and pass textComponent.troikaTextMesh.textRenderInfo to those functions.

I'd also accept a PR that exposes them as methods on the aframe component; I'd kept them off the Text class for tree shaking but it's not too much extra to add to the aframe-troika-text bundle.

@Utopiah
Copy link
Contributor Author

Utopiah commented Mar 30, 2023

Thanks, maybe I missed something though so just to be sure I don't dig where I shouldn't... right now from the AFrame component is there a way to have a cursor, going from glyph to glyph by knowing its relative or absolute position to e.g display behind it a plane or just an _ under?

@lojjic
Copy link
Owner

lojjic commented Mar 30, 2023

Not built in, no. Those selectionUtils functions give you all the data you need to implement such a thing, though. Some other folks have built similar things but I don't know if any are for aframe specifically. An example: https://twitter.com/__jberesford__/status/1609766045891571713

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants