fix: clear selection if row deleted is included

Signed-off-by: mertmit <mertmit99@gmail.com>
This commit is contained in:
mertmit
2023-06-29 10:16:02 +03:00
parent cde228ffdb
commit 8a2a3846e4
3 changed files with 30 additions and 17 deletions

View File

@@ -24,6 +24,24 @@ export class CellRange {
return !this.isEmpty() && this._start?.row === this._end?.row
}
isCellInRange(cell: Cell) {
return (
!this.isEmpty() &&
cell.row >= this.start.row &&
cell.row <= this.end.row &&
cell.col >= this.start.col &&
cell.col <= this.end.col
)
}
isRowInRange(row: number) {
return !this.isEmpty() && row >= this.start.row && row <= this.end.row
}
isColInRange(col: number) {
return !this.isEmpty() && col >= this.start.col && col <= this.end.col
}
get start(): Cell {
return {
row: Math.min(this._start?.row ?? NaN, this._end?.row ?? NaN),