mobile and desktop fix

This commit is contained in:
biglyderv 2025-05-20 21:13:54 -04:00
parent d28b0e898b
commit 58779f7f86
Signed by: biglyderv
GPG key ID: 0E2EB0B4CD7397B5

View file

@ -33,6 +33,14 @@ function Canvas(width, height, upscale) {
that.pageY = e.touches[0].pageY; 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) { this.elem.addEventListener('mousedown', function (e) {
that.clicked = true; that.clicked = true;
}); });
@ -57,19 +65,9 @@ function Canvas(width, height, upscale) {
e.preventDefault(); e.preventDefault();
}) })
this.elem.addEventListener('mouseup', function (e) { this.elem.addEventListener('mouseup', unclicker);
that.clicked = false;
that.firstX = this.pageX; this.elem.addEventListener('touchend',unclicker);
that.firstY = this.pageY;
});
this.elem.addEventListener('touchend', function (e) {
that.clicked = false;
that.firstX = this.pageX;
that.firstY = this.pageY;
});
this.clicked = false; this.clicked = false;