From: Elijah Cohen Date: Sat, 2 Apr 2022 04:26:37 +0000 (-0500) Subject: slight improvements related to last commit X-Git-Url: https://git.eli173.com/?a=commitdiff_plain;h=cf0f67b4f01623787be524ad205a3d7e8935d4af;p=hexmata slight improvements related to last commit --- diff --git a/grid.js b/grid.js index 9bbf10e..830d4aa 100644 --- a/grid.js +++ b/grid.js @@ -37,19 +37,19 @@ class Hex { // methods for being displayed I guess - getCanvasCoords(xorig, yorig, scale, ispoint=true) { + getCanvasCoords(xorig, yorig, scale) { // x,y is origin place, scale is how much to multiply unit dist by var xi = 0; var yi = 0; // ispoint determines ^ or _ for how they look on top - if(ispoint) { - xi = scale * (Math.sqrt(3)*this.q+Math.sqrt(3)*this.r/2); - yi = scale * (this.r*3/2); - } + /*if(ispoint) {*/ + xi = scale * (Math.sqrt(3)*this.q+Math.sqrt(3)*this.r/2); + yi = scale * (this.r*3/2); + /*} else { xi = scale * (this.q*3/2); yi = scale * (Math.sqrt(3)*this.q/2+Math.sqrt(3)*this.r); - } + }*/ return {x: xi+xorig, y: yi+yorig} } diff --git a/play.js b/play.js index 21db4a1..53bf25b 100644 --- a/play.js +++ b/play.js @@ -150,10 +150,6 @@ rotateButtonHandler = function(e) { c.addEventListener('mousemove', radius_hover); // tf are those arguments globals are there for a reason - ctx.save(); - ctx.fillStyle="rgba(0.4,0.4,0.4,0.1)" - ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height); - ctx.restore(); } rotateThingy = function(evt) { c.removeEventListener('mousemove', radius_hover); @@ -167,10 +163,6 @@ rotateThingy = function(evt) { copyHandler = function(e) { c.onclick = e=>copyhex(e); c.addEventListener('mousemove', radius_hover); - ctx.save(); - ctx.fillStyle="rgba(0.4,0.4,0.4,0.1)" - ctx.fillRect(0,0,ctx.canvas.width,ctx.canvas.height); - ctx.restore(); } copyhex = function(evt) { diff --git a/wireworld.js b/wireworld.js index 362bff9..c6a9736 100644 --- a/wireworld.js +++ b/wireworld.js @@ -242,7 +242,7 @@ function drawState(ctx,st,x,y,sz) { function drawGrid(grid, ctx, cx, cy, scale) { ctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height); for(var i of grid.cells) { - coords = i.getCanvasCoords(cx, cy, scale, true); + coords = i.getCanvasCoords(cx, cy, scale); drawState(ctx, i.state, coords.x, coords.y, scale); } }