diff --git a/packages/core/src/internal/data-grid/render/data-grid-lib.ts b/packages/core/src/internal/data-grid/render/data-grid-lib.ts index 96eb1d90f..6fc88008c 100644 --- a/packages/core/src/internal/data-grid/render/data-grid-lib.ts +++ b/packages/core/src/internal/data-grid/render/data-grid-lib.ts @@ -59,9 +59,13 @@ export function gridSelectionHasItem(sel: GridSelection, item: Item): boolean { if (sel.columns.hasIndex(col) || sel.rows.hasIndex(row)) return true; if (sel.current !== undefined) { if (itemsAreEqual(sel.current.cell, item)) return true; - const toCheck = [sel.current.range, ...sel.current.rangeStack]; // FIXME: pointless alloc - for (const r of toCheck) { - // dont we have a function for this? + const range = sel.current.range; + const xMin = range.x; + const xMax = range.x + range.width; + const yMin = range.y; + const yMax = range.y + range.height; + if (col >= xMin && col < xMax && row >= yMin && row < yMax) return true; + for (const r of sel.current.rangeStack) { if (col >= r.x && col < r.x + r.width && row >= r.y && row < r.y + r.height) return true; } }