CursorPosition
ClassThe position of a text cursor for a given character index, returned by Text.getCursorPositions and Text3D.getCursorPositions.
- Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.
Since Lens Scripting v324
Index
Properties
Methods
Example
//@input Component.Text textComponent
var cursors = script.textComponent.getCursorPositions();
cursors.forEach(function (cursor) {
print("Character " + cursor.index + " cursor at " + cursor.position);
});
Properties
index
readonlyindex:number
Character index in the current text that this cursor precedes.
Since
Lens Scripting Version 324
position
readonlyposition:vec2
Position of the cursor, in the same coordinate space as the Text component's local layout.
Since
Lens Scripting Version 324
Methods
getTypeName()
staticgetTypeName():TypeName<CursorPosition>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<CursorPosition>
Since
Lens Scripting Version 324