Improve grid logic around vertically inverting row popovers

This commit is contained in:
Andrew Kingston 2023-06-15 14:23:33 +01:00
parent 6a42d76c62
commit 73cae6198f
1 changed files with 4 additions and 3 deletions

View File

@ -110,9 +110,10 @@ export const deriveStores = context => {
const rowVerticalInversionIndex = derived(
[visualRowCapacity, rowHeight],
([$visualRowCapacity, $rowHeight]) => {
return (
$visualRowCapacity - Math.ceil(MaxCellRenderHeight / $rowHeight) - 2
)
const maxCellRenderRows = Math.ceil(MaxCellRenderHeight / $rowHeight)
const topIdx = $visualRowCapacity - maxCellRenderRows - 2
const bottomIdx = maxCellRenderRows + 1
return Math.max(topIdx, bottomIdx)
}
)