From 465ed64ba489e99a0c30cc632d2258079f91d86f Mon Sep 17 00:00:00 2001 From: Patrick Date: Sat, 4 Jan 2025 22:40:26 +0100 Subject: [PATCH] renderOverhaul --- secret/mineSweeper/script.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/secret/mineSweeper/script.js b/secret/mineSweeper/script.js index d1cb835..f37cb34 100644 --- a/secret/mineSweeper/script.js +++ b/secret/mineSweeper/script.js @@ -139,10 +139,10 @@ class Minesweeper { } drawField() { - canvas.width = window.innerWidth; - canvas.height = window.innerHeight; - const squareWidth = canvas.width / (this.field.length + 4); - const squareHeight = canvas.height / (this.field[0].length + 4); + const squareWidth = window.innerWidth / (this.field.length + 4); + const squareHeight = window.innerHeight / (this.field[0].length + 4); + canvas.width = squareWidth * this.field.length; + canvas.height = squareHeight * this.field[0].length; squareHeight > squareWidth ? this.size = squareWidth : this.size = squareHeight; const offsetX = (canvas.width - (this.field.length * this.size)) / 2; -- 2.39.5