From 2c1a5ae0e851d4680eb90390da502bf68c88c6c8 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 1 Mar 2023 20:14:50 +0000 Subject: [PATCH] Update hovered row on wheel --- .../src/components/sheet/SheetScrollWrapper.svelte | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/frontend-core/src/components/sheet/SheetScrollWrapper.svelte b/packages/frontend-core/src/components/sheet/SheetScrollWrapper.svelte index 0e7900204f..2ad169e8dc 100644 --- a/packages/frontend-core/src/components/sheet/SheetScrollWrapper.svelte +++ b/packages/frontend-core/src/components/sheet/SheetScrollWrapper.svelte @@ -9,6 +9,7 @@ columns, visibleRows, visibleColumns, + hoveredRowId, } = getContext("spreadsheet") export let scrollVertically = true @@ -78,6 +79,11 @@ ...state, top: newScrollTop, })) + + // Hover row under cursor + const y = e.clientY - $bounds.top + (newScrollTop % cellHeight) + const hoveredRow = $visibleRows[Math.floor(y / cellHeight)] + $hoveredRowId = hoveredRow?._id }