From 58779f7f86c50fad003ad755017187c2cdf837b5 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Tue, 20 May 2025 21:13:54 -0400 Subject: [PATCH] mobile and desktop fix --- js/core.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/js/core.js b/js/core.js index 5f2cced..92d8dd9 100644 --- a/js/core.js +++ b/js/core.js @@ -33,6 +33,14 @@ function Canvas(width, height, upscale) { that.pageY = e.touches[0].pageY; } + function unclicker(e) { + that.clicked = false; + + that.firstX = this.pageX; + that.firstY = this.pageY; + } + + this.elem.addEventListener('mousedown', function (e) { that.clicked = true; }); @@ -57,19 +65,9 @@ function Canvas(width, height, upscale) { e.preventDefault(); }) - this.elem.addEventListener('mouseup', function (e) { - that.clicked = false; + this.elem.addEventListener('mouseup', unclicker); - that.firstX = this.pageX; - that.firstY = this.pageY; - }); - - this.elem.addEventListener('touchend', function (e) { - that.clicked = false; - - that.firstX = this.pageX; - that.firstY = this.pageY; - }); + this.elem.addEventListener('touchend',unclicker); this.clicked = false;