From 30d42d29c126b5b4f17ea28a42142b75bdd59e74 Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Sat, 7 Dec 2024 12:41:03 -0800 Subject: [PATCH] Oops, fix magnifier position bug when page is scrolled --- app/assets/javascripts/magic-magnifier.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/magic-magnifier.js b/app/assets/javascripts/magic-magnifier.js index f671bf45..50aad10e 100644 --- a/app/assets/javascripts/magic-magnifier.js +++ b/app/assets/javascripts/magic-magnifier.js @@ -14,8 +14,8 @@ class MagicMagnifier extends HTMLElement { #onMouseMove(e) { const lens = this.querySelector("magic-magnifier-lens"); const rect = this.getBoundingClientRect(); - const x = e.pageX - rect.left; - const y = e.pageY - rect.top; + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; this.style.setProperty("--magic-magnifier-x", x + "px"); this.style.setProperty("--magic-magnifier-y", y + "px"); }