SelectionRange

The SelectionRange class is a simple CellRanges collection designed for easy manipulation of the multiple
consecutive and non-consecutive selections.

Members

rangesArray.<CellRange>

List of all CellRanges added to the class instance.

Methods

add(coords){SelectionRange}

Add coordinates to the class instance. The new coordinates are added to the end of the range collection.

Parameters:
Name Type Description
coords CellCoords

The CellCoords instance with defined visual coordinates.

Returns: {SelectionRange}

clear(){SelectionRange}

Clear collection.

Returns: {SelectionRange}

current(){CellRange|undefined}

Get last added coordinates from ranges, it returns a CellRange instance.

Returns: {CellRange|undefined}

includes(coords){boolean}

Returns true if coords is within selection coords. This method iterates through all selection layers to check if
the coords object is within selection range.

Parameters:
Name Type Description
coords CellCoords

The CellCoords instance with defined visual coordinates.

Returns: {boolean}

isEmpty(){boolean}

Check if selected range is empty.

Returns: {boolean}

peekByIndex(offset){CellRange|undefined}

Peek the coordinates based on the offset where that coordinate resides in the collection.

Parameters:
Name Type Default Description
offset number 0 optional

An offset where the coordinate will be retrieved from.

Returns: {CellRange|undefined}

Removes from the stack the last added coordinates.

Returns: {SelectionRange}

previous(){CellRange|undefined}

Get previously added coordinates from ranges, it returns a CellRange instance.

Returns: {CellRange|undefined}

set(coords){SelectionRange}

Set coordinates to the class instance. It clears all previously added coordinates and push coords
to the collection.

Parameters:
Name Type Description
coords CellCoords

The CellCoords instance with defined visual coordinates.

Returns: {SelectionRange}

size(){number}

Get count of added all coordinates added to the selection.

Returns: {number}
Class: SelectionRange