diff --git a/package.json b/package.json index c864835..7e95600 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "minesweeper", - "version": "0.83.1", + "version": "0.83.2", "description": "Just Minesweeper!", "author": "Florine W. Dekker", "browser": "dist/bundle.js", diff --git a/src/main/js/Common.ts b/src/main/js/Common.ts index 15887c6..5d599f0 100644 --- a/src/main/js/Common.ts +++ b/src/main/js/Common.ts @@ -2,14 +2,6 @@ import alea from "alea"; -/** - * Removes focus from the currently active element, if possible. - */ -export function blurActiveElement(): void { - // @ts-ignore - document.activeElement?.blur?.(); -} - /** * Slices `array` into chunks of `chunkSize` elements each. * @@ -110,7 +102,7 @@ export function waitForForkAwesome(onSuccess: () => void, onFailure: () => void, const ctx = canvas.getContext("2d")!; const fontSize = 36; const testCharacter = "\uF047"; - const targetPixelCount = 500; + const targetPixelCount = 528; // Found by doing lots of trials const ccw = canvas.width = fontSize * 1.5; const cch = canvas.height = fontSize * 1.5; diff --git a/src/main/js/Game.ts b/src/main/js/Game.ts index c99523c..2f90c2a 100644 --- a/src/main/js/Game.ts +++ b/src/main/js/Game.ts @@ -360,8 +360,8 @@ export class Game { toggleHref(this.undo, !!this.field?.canUndo()); toggleHref(this.redo, !!this.field?.canRedo()); - toggleHref(this.hint, !this.field?.isOver); - toggleHref(this.solve, !this.field?.isOver); + toggleHref(this.hint, !!this.field?.hasStarted && !this.field?.isOver); + toggleHref(this.solve, !!this.field?.hasStarted && !this.field?.isOver); } /** @@ -399,6 +399,7 @@ export class Game { ); this.display.setField(this.field); this.field.addEventListener(() => this.updateControls()); + this.updateControls(); // Start timer for statistics let lastTime: number | null = null; diff --git a/src/main/js/ModalDialog.ts b/src/main/js/ModalDialog.ts index 29b4612..3af394d 100644 --- a/src/main/js/ModalDialog.ts +++ b/src/main/js/ModalDialog.ts @@ -1,7 +1,5 @@ const {$} = (window as any).fwdekker; -import {blurActiveElement} from "./Common"; - /** * A modal dialog displayed in HTML. @@ -100,7 +98,6 @@ export class ModalDialog { * Opens the dialog. */ open(): void { - blurActiveElement(); setTimeout(() => $("[autofocus]", this.dialog)?.focus(), 100); this.dialog.setAttribute("open", "true");