caretVisual
import { caretVisual } from 'pixi-silk/text';
function caretVisual(
layout: TextLayout,
index: number,
dir: number,
upstream?: boolean,
isStop?: (index: number) => boolean,
leading?: boolean
): CaretStop | null;
The caret stop one step left (dir -1) or right (1) on screen from index, on the same line.
In a line that mixes directions this follows what the eye sees, not the order of the text. The
arrow keys then move the way they point, and a caret can reach both places an offset has where
the direction changes. Returns null on a line that runs left to right only, or at the line’s edge:
step through the text instead there. isStop filters the stops, for example to grapheme or word
boundaries.
Parameters#
| Parameter | Type | Default value |
|---|---|---|
layout | TextLayout | undefined |
index | number | undefined |
dir | number | undefined |
upstream | boolean | false |
isStop? | (index: number) => boolean | undefined |
leading? | boolean | false |
Returns#
CaretStop | null