A game is easier to judge and to play without the editor around it. The Game tab and the game link now both have a button that puts the game view itself into fullscreen, not just the browser window. - The Game tab header has a fullscreen button on the right. It hides toolbar, panels, tab headers and console and keeps the zoom from the picker. A running game keeps running. - A corner button at the top right, or Esc, leaves fullscreen and puts the view back into the tab where it was. - The game link shows the same corner button. Over a running game it hides after 2 s without mouse movement and returns on the next move. - A click on the corner button never reaches the game. - Stop ends fullscreen. Stop switches back to the Scene tab, and any switch away from the Game tab ends fullscreen, so no empty screen is left behind. - src/viewport/fullscreen.ts wraps the Fullscreen API and holds the rule for when the button shows. FullscreenCorner.ts is the button used by both pages. Two SVG icons are new. - Editor.showGameFullscreen moves the GameViewport into the root while fullscreen is on. Tests: - ./check.sh: 195 files, 2815 tests, exit 0 (3 new unit tests). - e2e 60: 2 new checks for the corner button on the game link. - e2e 61 (new): 4 checks for fullscreen in the editor. - Full e2e run (local): ALL PASSED, 1580 checks. - Counter-checks fail as expected: rule without "no game running", no stopPropagation (60h), no end on tab switch (61c), no reparenting of the view (61a). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
1.0 KiB
TypeScript
24 lines
1.0 KiB
TypeScript
/** When the fullscreen button in the corner of a game shows (#267). */
|
|
import { describe, expect, it } from 'vitest';
|
|
import { CORNER_BUTTON_IDLE_SECONDS, showsCornerButton } from '../../src/viewport/fullscreen';
|
|
|
|
describe('showsCornerButton', () => {
|
|
it('always shows while no game runs, however long the mouse rests', () => {
|
|
expect(showsCornerButton({ running: false, idleSeconds: 60, overButton: false })).toBe(true);
|
|
});
|
|
|
|
it('shows over a running game only while the mouse moved lately', () => {
|
|
expect(showsCornerButton({ running: true, idleSeconds: 0, overButton: false })).toBe(true);
|
|
expect(
|
|
showsCornerButton({ running: true, idleSeconds: CORNER_BUTTON_IDLE_SECONDS - 0.1, overButton: false }),
|
|
).toBe(true);
|
|
expect(
|
|
showsCornerButton({ running: true, idleSeconds: CORNER_BUTTON_IDLE_SECONDS, overButton: false }),
|
|
).toBe(false);
|
|
});
|
|
|
|
it('stays while the pointer rests on it', () => {
|
|
expect(showsCornerButton({ running: true, idleSeconds: 60, overButton: true })).toBe(true);
|
|
});
|
|
});
|