Skip to content

Commit 0488980

Browse files
committed
Allow nudge cell size
1 parent 2442c6e commit 0488980

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

game.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ class MinesweeperRound {
3232

3333
let windowGrabberHeight = document.querySelector(".window-header").getBoundingClientRect().height;
3434
let borderSize = getComputedStyle(document.documentElement).getPropertyValue("--border-size").split("px")[0];
35-
// resizeCanvas(width - borderSize * 2, height - borderSize * 3);
3635

3736
if (trF >= trC) {
3837
cellSize = (window.innerWidth * 0.9 - borderSize * 2) / (this.width + 1);
@@ -55,7 +54,9 @@ class MinesweeperRound {
5554
}
5655

5756
initGame() {
58-
this.calculateCellSizes();
57+
if (cellSize === 0) {
58+
this.calculateCellSizes();
59+
}
5960

6061
this.grid = Array();
6162
for (let i = 0; i < this.width * this.height; i++) {

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,10 @@ <h2>Mines:</h2>
307307
if (!cell.revealed) {
308308
game.flagCell(mX, mY);
309309
}
310+
} else if (keyCode === 189) {
311+
game.calculateCellSizes(cellSize - 5);
312+
} else if (keyCode === 187) {
313+
game.calculateCellSizes(cellSize + 5);
310314
}
311315
}
312316

0 commit comments

Comments
 (0)