diff --git a/js/core.js b/js/core.js index aa3578c..3846d5f 100644 --- a/js/core.js +++ b/js/core.js @@ -30,6 +30,10 @@ function Canvas(width, height, upscale) { this.elem.addEventListener('mousedown', function (e) { that.clicked = true; }); + this.elem.addEventListener('touchstart', function (e) { + that.clicked = true; + }); + this.elem.addEventListener('touchmove', function (e) { that.pageX = e.touches[0].pageX; @@ -60,6 +64,13 @@ function Canvas(width, height, upscale) { 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.pageX = 0;