Interface ICursorHandler
Handler for performing simple operations with the cursor.
Package: @aurigma/design-atoms-text
Properties
cursorChangeEvent
Cursor change event.
Declaration
cursorChangeEvent: EventObject<IPositionInText>;
Property Value
| Type | Description |
|---|---|
| EventObject<IPositionInText> | Cursor change event. |
Remarks
Reports the current cursor position.
Methods
getCurrentParagraphIndex()
Returns the current index of the paragraph.
Declaration
getCurrentParagraphIndex(): number;
Returns
| Type | Description |
|---|---|
| number |
getCurrentPosition()
Returns the current cursor position.
Declaration
getCurrentPosition(): IPositionInText;
Returns
| Type | Description |
|---|---|
| IPositionInText |
getCurrentWord()
Returns the text range of the word the cursor is on.
Declaration
getCurrentWord(): ITextRange;
Returns
| Type | Description |
|---|---|
| ITextRange |
Remarks
not only the current word is selected, but also the gap to the next word.
getFirstPosition()
Returns the first position in the text.
Declaration
getFirstPosition(): IPositionInText;
Returns
| Type | Description |
|---|---|
| IPositionInText |
getPositionByPoint(point)
Returns the position in the text by point.
Declaration
getPositionByPoint(point: IPoint): IPositionInText;
Parameters
| Type | Name | Description |
|---|---|---|
| IPoint | point |
point coordinates |
Returns
| Type | Description |
|---|---|
| IPositionInText |
Remarks
the cursor does not move.
moveToDirection(direction)
Moves the current cursor position in the specified direction.
Declaration
moveToDirection(direction: MoveDirectionType): boolean;
Parameters
| Type | Name | Description |
|---|---|---|
| MoveDirectionType | direction |
direction of cursor movement. |
Returns
| Type | Description |
|---|---|
| boolean |
setToPoint(point)
Sets the cursor to a point in the text.
Declaration
setToPoint(point: IPoint): void;
Parameters
| Type | Name | Description |
|---|---|---|
| IPoint | point |
the expected point. |
Returns
| Type | Description |
|---|---|
| void |
setToPosition(position)
Sets the cursor at a position in the text.
Declaration
setToPosition(position: IPositionInText): void;
Parameters
| Type | Name | Description |
|---|---|---|
| IPositionInText | position |
the expected position in the text. |
Returns
| Type | Description |
|---|---|
| void |