From 5b0712db6348e5205187cbdd5dec9186eb8b9824 Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Fri, 3 Sep 2021 14:15:38 -0400 Subject: [PATCH] Fix the click-test canvas being way too large --- macrovision.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/macrovision.js b/macrovision.js index 378fc3a3..49cfaa6e 100644 --- a/macrovision.js +++ b/macrovision.js @@ -1731,14 +1731,12 @@ function testClick(event) { [xTarget,yTarget] = [x,y]; [actualW, actualH] = [target.getBoundingClientRect().width, target.getBoundingClientRect().height]; - xTarget -= actualW/2; + xTarget /= ratio; - xTarget += actualW/2; - yTarget -= actualH/2; yTarget /= ratio; - yTarget += actualH/2; - + actualW /= ratio; + actualH /= ratio; testCtx.canvas.width = actualW; testCtx.canvas.height = actualH; @@ -1747,6 +1745,9 @@ function testClick(event) { // dear future me: Sorry :( + console.log(w, h); + console.log(actualW, actualH) + console.log(xTarget, yTarget) testCtx.resetTransform();