You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a necessary feature for eventually enabling text selection/highlighting/editing.
We need the ability to raycast a position in a rendered text block, and for that position determine the closest character boundary to it, returning an index in the original text string.
It's easy enough to resolve the glyph index, by searching through the glyph rects array, but there isn't a clean way to resolve the glyph index back to string char index. These aren't always 1-to-1 due to ligature substitution etc. This may require modifying Typr.js to persist char indexes with the glyphs.
The text was updated successfully, but these errors were encountered:
This has been implemented in selectionUtils.js#getCaretAtPoint which resolves an x/y to the nearest caret position. The resulting caret object holds a charIndex property.
This is a necessary feature for eventually enabling text selection/highlighting/editing.
We need the ability to raycast a position in a rendered text block, and for that position determine the closest character boundary to it, returning an index in the original text string.
It's easy enough to resolve the glyph index, by searching through the glyph rects array, but there isn't a clean way to resolve the glyph index back to string char index. These aren't always 1-to-1 due to ligature substitution etc. This may require modifying Typr.js to persist char indexes with the glyphs.
The text was updated successfully, but these errors were encountered: