From f692fa9575bde6b4f7ddf37adeec93edf9dfcd13 Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Wed, 26 Jan 2022 16:59:00 -0800 Subject: [PATCH] Works! Signed-off-by: James Ketrenos --- client/.env | 1 + client/package.json | 1 + client/src/App.css | 5 +++++ client/src/Board.js | 11 +++++++++-- server/package.json | 6 +++--- 5 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 client/.env diff --git a/client/.env b/client/.env new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/client/.env @@ -0,0 +1 @@ + diff --git a/client/package.json b/client/package.json index a37c31f..71ec120 100644 --- a/client/package.json +++ b/client/package.json @@ -9,6 +9,7 @@ "@testing-library/jest-dom": "^5.16.1", "@testing-library/react": "^12.1.2", "@testing-library/user-event": "^13.5.0", + "moment": "^2.29.1", "react": "^17.0.2", "react-dom": "^17.0.2", "react-moment": "^1.1.1", diff --git a/client/src/App.css b/client/src/App.css index 65e5766..cf8afa0 100755 --- a/client/src/App.css +++ b/client/src/App.css @@ -1,3 +1,8 @@ body { font-family: 'Droid Sans', 'Arial Narrow', Arial, sans-serif; } + +#root { + width: 100vw; + height: 100vh; +} \ No newline at end of file diff --git a/client/src/Board.js b/client/src/Board.js index ffb7da0..df8aeea 100755 --- a/client/src/Board.js +++ b/client/src/Board.js @@ -633,13 +633,15 @@ class Board extends React.Component { } updateDimensions() { + const hasToolbar = false; + if (this.updateSizeTimer) { clearTimeout(this.updateSizeTimer); } this.updateSizeTimer = setTimeout(() => { const container = document.getElementById("root"), - offset = container.firstChild.offsetHeight, + offset = hasToolbar ? container.firstChild.offsetHeight : 0, height = window.innerHeight - offset; this.offsetY = offset; @@ -665,12 +667,16 @@ class Board extends React.Component { return; } + if (this.canvas.width === 0 || this.canvas.height === 0) { + return; + } + const ctx = this.canvas.getContext("2d"); ctx.clearRect(0, 0, this.canvas.width, this.canvas.height); ctx.save(); ctx.strokeStyle = 'white'; - ctx.filleStyle = 'rgba(0, 0, 0, 0)'; + ctx.fillStyle = 'rgba(0, 0, 0, 0)'; this.minSize = Math.min(this.canvas.height, this.canvas.width); /* @@ -726,6 +732,7 @@ class Board extends React.Component { } } ctx.restore(); + ctx.scale(this.minSize / hexagonRatio, this.minSize / hexagonRatio); ctx.translate(0.5 * hexagonRatio, 0.5 * hexagonRatio); ctx.lineWidth = 2. / this.minSize; diff --git a/server/package.json b/server/package.json index c051ac6..6cbfaff 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "peddlers-of-ketran-server", - "version": "1.0.0", + "version": "1.0.0", "main": "app.js", "devDependencies": {}, "scripts": { @@ -30,5 +30,5 @@ "repository": { "type": "git", "url": "git@git.ketrenos.com:jketreno/peddlers-of-ketran" - } - } + } +}