* Check if a cell at (x, y) is within the current selection. * Uses cached selection coordinates for performance.
(x: number, y: number)
| 901 | * Uses cached selection coordinates for performance. |
| 902 | */ |
| 903 | private isInSelection(x: number, y: number): boolean { |
| 904 | const sel = this.currentSelectionCoords; |
| 905 | if (!sel) return false; |
| 906 | |
| 907 | const { startCol, startRow, endCol, endRow } = sel; |
| 908 | |
| 909 | // Single line selection |
| 910 | if (startRow === endRow) { |
| 911 | return y === startRow && x >= startCol && x <= endCol; |
| 912 | } |
| 913 | |
| 914 | // Multi-line selection |
| 915 | if (y === startRow) { |
| 916 | // First line: from startCol to end of line |
| 917 | return x >= startCol; |
| 918 | } else if (y === endRow) { |
| 919 | // Last line: from start of line to endCol |
| 920 | return x <= endCol; |
| 921 | } else if (y > startRow && y < endRow) { |
| 922 | // Middle lines: entire line is selected |
| 923 | return true; |
| 924 | } |
| 925 | |
| 926 | return false; |
| 927 | } |
| 928 | |
| 929 | /** |
| 930 | * Set the currently hovered hyperlink ID for rendering underlines |
no outgoing calls
no test coverage detected