]> git.eli173.com Git - hexmata/commitdiff
slight improvements related to last commit
authorElijah Cohen <eli@eli173.com>
Sat, 2 Apr 2022 04:26:37 +0000 (23:26 -0500)
committerElijah Cohen <eli@eli173.com>
Sat, 2 Apr 2022 04:26:37 +0000 (23:26 -0500)
grid.js
play.js
wireworld.js

diff --git a/grid.js b/grid.js
index 9bbf10e79d48a0b116b058b8b2de06deca9b1fa4..830d4aac5af8b36bca075161972ef6fb02e18747 100644 (file)
--- 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 21db4a19fbc5fe5f4fd5399298a1f92662665d50..53bf25b9f3f54b9e382b3a70f0a3d7d09799b464 100644 (file)
--- 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) {
index 362bff9674fc3f935db2b05fae08f422c5b858be..c6a97363983f864fc0349cdeb58436258768434a 100644 (file)
@@ -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);
                }
 }