From eb7dbee2560f8cf29bf9144985cf1588c28a1be1 Mon Sep 17 00:00:00 2001 From: Rakibul-GDN <101200128+Rakibul-GDN@users.noreply.github.com> Date: Tue, 1 Aug 2023 16:19:39 +0600 Subject: [PATCH] Using screenX, screenY instead of pageX, pageY for transform calculation --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index b85775c..72cd4b9 100644 --- a/src/index.js +++ b/src/index.js @@ -69,8 +69,8 @@ class Zoom extends Component { }, } = this.imageRef - const x = ((e.pageX - offsetLeft) / parseInt(width, 10)) * 100 - const y = ((e.pageY - offsetTop) / parseInt(height, 10)) * 100 + const x = ((e.screenX - offsetLeft) / parseInt(width, 10)) * 100 + const y = ((e.screenY - offsetTop) / parseInt(height, 10)) * 100 this.setState({ mouseX: x,