diff --git a/css/core.css b/css/core.css index ff87e6e..d7e54cb 100644 --- a/css/core.css +++ b/css/core.css @@ -56,6 +56,7 @@ div#header-title { #header-links a { margin-top: 0; + text-decoration: none; } #header { diff --git a/js/core.js b/js/core.js index 8a5625b..61f067c 100644 --- a/js/core.js +++ b/js/core.js @@ -27,18 +27,18 @@ function Canvas(width, height, upscale) { let that = this; + function clicker(e) { + that.clicked = true; + that.pageX = e.touches[0].pageX; + that.pageY = e.touches[0].pageY; + } + this.elem.addEventListener('mousedown', function (e) { that.clicked = true; }); - this.elem.addEventListener('touchstart', function (e) { - that.clicked = true; - }); + this.elem.addEventListener('touchstart', clicker); - - this.elem.addEventListener('touchmove', function (e) { - that.pageX = e.touches[0].pageX; - that.pageY = e.touches[0].pageY; - }) + this.elem.addEventListener('touchmove', clicker) this.elem.addEventListener('mousemove', function (e) { that.pageX = e.pageX; @@ -57,18 +57,18 @@ function Canvas(width, height, upscale) { e.preventDefault(); }) - this.elem.addEventListener('mouseup', function (e) { + this.elem.addEventListener('touchend', function (e) { that.clicked = false; that.firstX = this.pageX; that.firstY = this.pageY; }); - this.elem.addEventListener('touchend', function (e) { + this.elem.addEventListener('mouseup', function (e) { that.clicked = false; - that.firstX = this.pageX; - that.firstY = this.pageY; + that.firstX = e.touches[0].pageY; + that.firstY = e.touches[0].pageY; }); @@ -163,12 +163,14 @@ Canvas.prototype.render = function () { this.ctx.strokeStyle = 'rgb(255,255,255)'; this.ctx.lineWidth = 2; + + let theX = Math.floor(x / this.upscale); + let theY = Math.floor(y / this.upscale); if (this.isMouseOver || this.forceShowTilePlacement) - this.ctx.strokeRect(x / this.upscale, y / this.upscale, this.radius * 2 + 2, this.radius * 2 + 2); - - let theX = Math.floor(x / this.upscale + this.radius + 1); - let theY = Math.floor(y / this.upscale + this.radius + 1); + this.ctx.strokeRect(theX, theY, this.radius * 2 + 2, this.radius * 2 + 2); + theX += this.radius + 1; + theY += this.radius + 1; let blok = mainTiles.tiles[this.getBlock(theX, theY)];