Update hovered row on wheel

This commit is contained in:
Andrew Kingston 2023-03-01 20:14:50 +00:00
parent 15c07e13ac
commit 2c1a5ae0e8
1 changed files with 6 additions and 0 deletions

View File

@ -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
}
</script>