diff options
Diffstat (limited to 'web/src/selection.ts')
| -rw-r--r-- | web/src/selection.ts | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/web/src/selection.ts b/web/src/selection.ts index 294db52..abaf8b5 100644 --- a/web/src/selection.ts +++ b/web/src/selection.ts @@ -17,6 +17,9 @@ export abstract class Selection { abstract extend(cellRef: CellRef): Selection; abstract getSelectedCells(grid: RenderedGrid): RenderedCell[][]; + + abstract startCellRef(): CellRef; + abstract endCellRef(): CellRef; } export class ActiveCellSelection extends Selection { @@ -34,6 +37,14 @@ export class ActiveCellSelection extends Selection { getSelectedCells(grid: RenderedGrid): RenderedCell[][] { return [[getRenderedCell(grid, this.activeCellRef)!]]; } + + startCellRef(): CellRef { + return this.activeCellRef; + } + + endCellRef(): CellRef { + return this.activeCellRef; + } } export type CellRange = [CellRef, CellRef]; @@ -101,4 +112,12 @@ export class RangeSelection extends Selection { return row.renderedCells.slice(firstCellIndex, lastCellIndex + 1); }); } + + startCellRef(): CellRef { + return this.range[0]; + } + + endCellRef(): CellRef { + return this.range[1]; + } } |
