From ce8f7205232ddd44d027bbf2ab9556d57deeccb6 Mon Sep 17 00:00:00 2001 From: "Z. Cliffe Schreuders" Date: Tue, 14 Oct 2025 17:23:07 +0100 Subject: [PATCH] Update Text File Minigame: Enhance window control functionality by implementing minimize and maximize actions. The minimize button now closes the minigame, while the maximize button toggles fullscreen mode. Update HTML documentation to clarify window control behavior. --- js/minigames/text-file/text-file-minigame.js | 28 +++++++++++++++++--- test-text-file-minigame.html | 2 +- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/js/minigames/text-file/text-file-minigame.js b/js/minigames/text-file/text-file-minigame.js index 6287090..c41fe5e 100644 --- a/js/minigames/text-file/text-file-minigame.js +++ b/js/minigames/text-file/text-file-minigame.js @@ -144,13 +144,13 @@ export class TextFileMinigame extends MinigameScene { }); this.addEventListener(this.minimizeBtn, 'click', () => { - // For now, just show a message (could implement minimize functionality later) - this.showSuccess("Minimize functionality not implemented", false, 2000); + // Minimize by closing the minigame (common behavior for modal windows) + this.complete(false); }); this.addEventListener(this.maximizeBtn, 'click', () => { - // For now, just show a message (could implement maximize functionality later) - this.showSuccess("Maximize functionality not implemented", false, 2000); + // Maximize by toggling fullscreen mode + this.toggleFullscreen(); }); // Copy button @@ -262,6 +262,26 @@ export class TextFileMinigame extends MinigameScene { this.showSuccess("All text selected", false, 1000); } + toggleFullscreen() { + // Toggle fullscreen mode for the minigame container + if (!document.fullscreenElement) { + // Enter fullscreen + this.container.requestFullscreen().then(() => { + this.showSuccess("Entered fullscreen mode", false, 1500); + }).catch(err => { + console.error('Error attempting to enable fullscreen:', err); + this.showSuccess("Fullscreen not supported", false, 1500); + }); + } else { + // Exit fullscreen + document.exitFullscreen().then(() => { + this.showSuccess("Exited fullscreen mode", false, 1500); + }).catch(err => { + console.error('Error attempting to exit fullscreen:', err); + }); + } + } + addToNotebook() { // Check if there's content to add if (!this.textFileData.fileContent || this.textFileData.fileContent.trim() === '') { diff --git a/test-text-file-minigame.html b/test-text-file-minigame.html index 99e834c..087de35 100644 --- a/test-text-file-minigame.html +++ b/test-text-file-minigame.html @@ -95,7 +95,7 @@

• Text file minigame should open with Mac-style window decorations

• VT323 font should be used for all text content

• Black text on white background (clean, readable interface)

-

• Window controls (close, minimize, maximize) should be functional

+

• Window controls: close (red), minimize (yellow - closes window), maximize (green - toggles fullscreen)

• "Add to Notebook" button should work (if notes minigame is available)

• Copy and Select All buttons should function

• Escape key should close the minigame