This commit is contained in:
kolaflash
2026-01-24 17:53:31 +01:00
parent f9a2409dad
commit 175ea1b726
5 changed files with 16 additions and 8 deletions
+3 -3
View File
@@ -54,11 +54,11 @@ function adjustPointerPosition(
clientX: number,
clientY: number,
): void {
const { ctx, translation: position, initialScale } = viewport;
const { ctx, translation: position, scale } = viewport;
const clientRect = ctx.canvas.getBoundingClientRect();
pointer.position.x = (clientX - clientRect.x + position.x) / initialScale;
pointer.position.y = (clientY - clientRect.y + position.y) / initialScale;
pointer.position.x = (clientX - clientRect.x + position.x) / scale;
pointer.position.y = (clientY - clientRect.y + position.y) / scale;
}
export function listenPointer(): () => void {