From f7211bbc4853f4ecac500aa8af4916f35fc58f2c Mon Sep 17 00:00:00 2001 From: Igor Zinken Date: Sun, 4 Dec 2022 19:35:34 +0100 Subject: [PATCH] Use passed event properties instead of window.event in global to local point conversion --- src/math/point-math.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/math/point-math.js b/src/math/point-math.js index ee174bb..dd0ddc4 100644 --- a/src/math/point-math.js +++ b/src/math/point-math.js @@ -123,8 +123,8 @@ export const pointerToCanvasCoordinates = ( pointerX, pointerY, zoomableCanvas, // ( pointer coordinate - bounding box coordinate ) is coordinate relative to canvas // by dividing this by the zoomFactor the value is scaled to the canvas' relative scale - const offsetX = ( event.pageX - canvasBoundingBox.left ) / zoomFactor; - const offsetY = ( event.pageY - canvasBoundingBox.top ) / zoomFactor; + const offsetX = ( pointerX - canvasBoundingBox.left ) / zoomFactor; + const offsetY = ( pointerY - canvasBoundingBox.top ) / zoomFactor; // subtract the canvas viewport position to get the coordinate relative to currently // visible area within the BitMappery document