SelectionCoordinates
A class representing the line & column of the selection in a textarea. Should be used in pair with the SelectionModel class.
constructor();
Implicit constructor. Takes no arguments, and does nothing except of creating a new instance.
start
and end
start: LineAndColumn;
end: LineAndColumn;
Those properties represent the start and end of the selection in the form of line and column numbers. The line & column values are a 0-based index of the position.
direction
direction: SelectionDirection;
Represents the direction of the selection. Can be any value permitted by SelectionDirection type.
generate
generate(selection: SelectionModel, code: string): void;
Assigns new values to the start
and end
properties, based on the provided selection model and string of code from the textarea. Also updates the direction
property accordingly.
selection
- A SelectionModel instance containing the selection range.code
- The code string where the selection was made.get
get(): SelectionRange<LineAndColumn>;
Returns the selection coordinates as a range of LineAndColumn objects.
getOrdered
getOrdered(): SelectionRange<LineAndColumn>;
Returns the selection coordinates as a range of LineAndColumn objects, with the start
and end
values reversed if the selection direction is backward.