Skip to content

Commit 5402bfb

Browse files
committed
Update coordinate calculations in updateGrid function to account for window scrolling
1 parent 7c181cf commit 5402bfb

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

assets/main.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ function updateGrid() {
4747
for (let line of lines) {
4848
const rect = line.getBoundingClientRect();
4949
lineCache.set(line, {
50-
x: rect.left + rect.width / 2,
51-
y: rect.top + rect.height / 2
50+
x: rect.left + rect.width / 2 + window.scrollX,
51+
y: rect.top + rect.height / 2 + window.scrollY
5252
});
5353
}
5454
}

0 commit comments

Comments
 (0)