Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ a new game or a change keeps to them.
- **Only the user moves the view.** No game flies to another board by itself. A single tap
never selects another board; a double tap brings one in; a tap on the board you are on is
the game's. A long press does nothing to the bottom row (Nov 22; Minesweeper keeps its flag): the dots open it, its × shuts it.
A double click on the board you are on shows it full screen and playable, alone (Dec 1, `focusOpen`, `docs/field.md`); a double click or
Escape goes back. An app that takes the double itself keeps it; the labs show theirs in their own view (`soloOnDouble`).
- **Games play with the row shut.** The row never opens by itself; what a gesture cannot do
goes on the play pad (`playActs`). An editor's row is opened by its ✎ or menu item.
Small tools always at hand (a palette, undo) go on the tool bar (`toolTiles`, `onToolTap`, Nov 26): icons only, chips in the
Expand Down
15 changes: 15 additions & 0 deletions docs/field.md
Original file line number Diff line number Diff line change
Expand Up @@ -823,3 +823,18 @@ Four of smoke part 1's checks had been failing since the Nov 28 changes, on `mai
nearer or farther; a double click, Escape (or leaving the browser's full screen) or its × (the menu button's ring) shuts it. While it is
open the field is not built or drawn under it (the frame loop skips as when resting) and its movement keys go nowhere. Part 5 checks each lab
with real double clicks: opened over the whole page with its pieces and title, turned by a drag, shut by a double click.

- **The board you are on, full screen** (1 Dec 2026: "Could we add double click to full screen to the games to?", and of three ways put,
"Playable focus"; THE BOARD YOU ARE ON, FULL SCREEN, `FOCUS`, `focusOpen`, `focusClose`, `focusTick`, `window.fieldFocus`). A double click on
the board you are on (the field's own double: `noDoubleTap` and `onDoubleTap` apps keep theirs, and the labs' `soloOnDouble` comes first)
frames it as before (forward, square, locked) and shows it full screen and alone: the browser's full screen, the board centred
(`liftRows` 0) at `FOCUS_FIT`, the menu's button, the bottom row's handle, the rings, the compass and the side strips hidden (`body.focus`),
no other board built (`buildInstances` skips every cell but the framed one) and the far field's fabric not shown. A clear sheet
(`#focusCover`) with the board's shape cut out (its corners at the foot and a piece's height above, projected each frame, their hull) takes
the taps that land off the board, so no unseen board is selected; on the board, taps, drags and keys go to the game as ever, and the play
pad and tool bar stay. A double click on the board, Escape, or leaving the browser's full screen goes back and frames the board as usual.
It took the double click on a framed, square, locked board, which let the lock go (Oct 31); the menu's Board lock does that. First tried
with a dark sheet over the other boards: drawn, they showed through the hole behind the far edge (where the back row's pieces stand and the
hole must rise), so they are not drawn instead. Part 5 checks checkers, mini golf and Tetris by real clicks (in full screen, the menu hidden,
the fabric off, a tap on the board reaching the game, back by a double click or Escape); part 7's board lock check leaves the full screen
after each locking double.
81 changes: 76 additions & 5 deletions games.html
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,10 @@
body #menuBtn.chip:hover, #playPad.low button:hover { background: rgba(18, 21, 28, .55); border-color: rgba(232, 200, 106, .95); }
body #menuBtn.chip[aria-pressed="true"], body #menuBtn.chip[aria-expanded="true"] { background: rgba(18, 21, 28, .55); color: #fff !important; border-color: rgba(232, 200, 106, .95); box-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
#playPad.low button { font-size: 1.125rem; }
/* (THE BOARD YOU ARE ON, FULL SCREEN, Dec 1: the page's own controls away, but the play pad and the tool bar; a dark sheet over the other boards) */
body.focus #menuBtn, body.focus #boardBrowser, body.focus #dials, body.focus #tiltZone, body.focus #thrustZone, body.focus #yawZone, body.focus #semiWrap,
body.focus #heatLegend, body.focus #bbHandle, body.focus #compass, body.focus #fitBtn, body.focus #indexBtn, body.focus #openBtn, body.focus #appBtn, body.focus #eloWrap, body.focus #menu { display: none !important; }
#focusCover { position: fixed; inset: 0; z-index: 25; background: transparent; display: none; touch-action: none; }
/* (ONE BOARD, ALONE, FULL SCREEN, Dec 1: its close button the menu's ring, its title in the field's own words) */
#soloView { position: fixed; inset: 0; z-index: 4000; background: #0e1420; touch-action: none; }
#soloView canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
Expand Down Expand Up @@ -6270,7 +6274,7 @@
const BOARD_LIFT_ROWS = 1; // rows to ride the board up in the view (0 = centered)
/* (Nov 28, 3D Tetris "fitted to the screen", then "continue center and fit boards": an app may say how many rows its board rides up, `frameLift`, so a
pit standing tall is centred in the room between the rings at the top and the buttons at the foot; every other app keeps BOARD_LIFT_ROWS) */
function liftRows(){ try { const a = window.getFieldApp && window.getFieldApp(), r = a && a.frameLift; if (isFinite(r)) return +r; } catch {} return BOARD_LIFT_ROWS; }
function liftRows(){ if (FOCUS.on) return 0; try { const a = window.getFieldApp && window.getFieldApp(), r = a && a.frameLift; if (isFinite(r)) return +r; } catch {} return BOARD_LIFT_ROWS; }
/* Persistent bird's-eye zoom, driven by the menu Zoom in/out buttons. SMALLER
= board framed tighter (camera lower); larger = wider (camera higher) —
zoomIn() multiplies by 1/BIRD_FIT_STEP and futureH is lerped straight from
Expand Down Expand Up @@ -6336,11 +6340,74 @@
/* Zoom-to-fit: frame the whole board so it fits the page, exactly like the
default view on page load. Driven by the 0 key and the toolbar buttons. */
function zoomBoardToFit(){
birdFit = FRAME_FIT; // the default (page-load) framing: whole board fits the page
birdFit = FOCUS.on ? FOCUS_FIT : FRAME_FIT; // the default (page-load) framing: whole board fits the page; in focus, as large as fits
syncZoomButtons();
resetThrust();
if (target.shown) frameBoard();
}
/* THE BOARD YOU ARE ON, FULL SCREEN (Dec 1: "Could we add double click to full screen to the games to?", then, of three ways put, "Playable
focus"). A double click on the board you are on (the field's own double: an app that takes the double itself, `onDoubleTap`, `noDoubleTap`,
keeps it, and the labs keep theirs, ONE BOARD, ALONE, FULL SCREEN) puts the page in the browser's full screen with that board alone: framed
square, in the middle and as large as it fits (FOCUS_FIT, `liftRows` 0), the menu's button, the bottom row's dots, the rings and the side
strips hidden (`body.focus`), and the other boards not built at all, nor the far field's picture of them (`buildInstances` skips every
board but this one, the fabric is not shown), and a clear sheet with the board's shape cut out of it (`#focusCover`, worked out each frame
from the board's corners on the screen, its top as well as its foot) taking the taps that land off the board, so no board unseen is
selected. (The sheet was dark at first and hid them; drawn, they showed through the hole behind the far edge, where the back row's pieces
stand, so they are not drawn instead.) The game is played as ever: its taps, drags and keys go to the field, and the play pad and the
tool bar stay. A double click on the board again, Escape, or leaving the browser's full screen brings the field back, the board framed as
before. This took the double click on the board you are on, which framed it square (still done, on the way in) and let its lock go when it
already was (the menu's Board lock does that). */
const FOCUS = { on: false, fs: false };
const FOCUS_FIT = 1.0;
let _focusCover = null;
function focusOpen(){
if (FOCUS.on || !target.shown) return;
FOCUS.on = true; FOCUS.fs = false; document.body.classList.add('focus');
if (window.__fieldFabric) window.__fieldFabric.visible = false; // (and the far field's picture of the boards past the tiles: none either)
if (!_focusCover){ _focusCover = document.createElement('div'); _focusCover.id = 'focusCover';
for (const ev of ['pointerdown', 'pointerup', 'click', 'dblclick', 'mousedown', 'mouseup', 'touchstart', 'touchend']) _focusCover.addEventListener(ev, e => { e.stopPropagation(); if (ev !== 'touchstart') e.preventDefault(); }, { passive: false });
_focusCover.addEventListener('wheel', e => { e.preventDefault(); e.stopPropagation(); }, { passive: false });
document.body.appendChild(_focusCover); }
_focusCover.style.display = 'block';
const el = document.documentElement;
try { if (!(document.fullscreenElement || document.webkitFullscreenElement)){ const r = (el.requestFullscreen || el.webkitRequestFullscreen).call(el, { navigationUI: 'hide' }); FOCUS.fs = true; if (r && r.catch) r.catch(() => { FOCUS.fs = false; }); } } catch { FOCUS.fs = false; }
zoomBoardToFit(); focusTick();
}
function focusClose(){
if (!FOCUS.on) return;
FOCUS.on = false; document.body.classList.remove('focus'); if (_focusCover) _focusCover.style.display = 'none';
if (window.__fieldFabric) window.__fieldFabric.visible = true;
try { if (FOCUS.fs && (document.fullscreenElement || document.webkitFullscreenElement)) (document.exitFullscreen || document.webkitExitFullscreen).call(document); } catch {}
FOCUS.fs = false; zoomBoardToFit();
try { window.fieldWake && window.fieldWake(); } catch {}
}
// the sheet's hole: the board's corners at its foot and a board's height above, each frame, the hull of those on the screen
const _focusP = new THREE.Vector3();
function focusTick(){
if (!FOCUS.on || !_focusCover) return;
if (!target.shown){ focusClose(); return; }
const L = window.LAB || {}, bW = gridSpacing() * BOARD_FILL * Math.max(0.3, Math.min(1.05, st.objSize)), hx = bW * (L.cellW || 1) / 2, hz = bW * (L.cellH || 1) / 2;
let up = 0.12 * bW; try { const a = window.getFieldApp && window.getFieldApp(); if (a && a.frameFit > 1) up *= a.frameFit; } catch {}
const W = innerWidth, H = innerHeight, pts = [];
try { camera.updateMatrixWorld(); } catch {}
for (const y of [0, up]) for (const sx of [-1, 1]) for (const sz of [-1, 1]){
_focusP.set(target.boardX + sx * hx, y, target.boardZ + sz * hz).project(camera);
if (_focusP.z > 1){ _focusCover.style.clipPath = 'none'; _focusCover.style.display = 'none'; return; } // (a corner behind the eye: no sheet this frame)
pts.push([(_focusP.x + 1) / 2 * W, (1 - _focusP.y) / 2 * H]); }
// (the hull, Andrew's monotone chain; a little room round it)
pts.sort((a, b) => a[0] - b[0] || a[1] - b[1]);
const cr = (o, a, b) => (a[0] - o[0]) * (b[1] - o[1]) - (a[1] - o[1]) * (b[0] - o[0]), lo = [], hi = [];
for (const p of pts){ while (lo.length >= 2 && cr(lo[lo.length - 2], lo[lo.length - 1], p) <= 0) lo.pop(); lo.push(p); }
for (let i = pts.length - 1; i >= 0; i--){ const p = pts[i]; while (hi.length >= 2 && cr(hi[hi.length - 2], hi[hi.length - 1], p) <= 0) hi.pop(); hi.push(p); }
const hull = lo.slice(0, -1).concat(hi.slice(0, -1)), cx = hull.reduce((a, p) => a + p[0], 0) / hull.length, cy = hull.reduce((a, p) => a + p[1], 0) / hull.length, pad = 0.03;
const d = hull.map(([x, y], i) => (i ? 'L' : 'M') + (x + (x - cx) * pad).toFixed(1) + ' ' + (y + (y - cy) * pad).toFixed(1)).join(' ');
_focusCover.style.display = 'block';
_focusCover.style.clipPath = `path(evenodd, "M0 0 H${W} V${H} H0 Z ${d} Z")`;
}
window.fieldFocus = { open: focusOpen, close: focusClose, get on(){ return FOCUS.on; } };
document.addEventListener('fullscreenchange', () => { if (FOCUS.on && FOCUS.fs && !document.fullscreenElement) { FOCUS.fs = false; focusClose(); } });
window.addEventListener('keydown', e => { if (e.key === 'Escape' && FOCUS.on && !SOLO.open){ e.preventDefault(); focusClose(); } }, true);
window.addEventListener('resize', () => { if (FOCUS.on && target.shown) setTimeout(() => { if (FOCUS.on) zoomBoardToFit(); }, 60); });

/* ─── Chess board tiles — flat 8×8 boards on the ground plane ─────────── */
/* One big InstancedMesh of unit planes; per-instance matrix + color = one
Expand Down Expand Up @@ -16201,6 +16268,7 @@
const _framed = target.shown
&& Math.abs(cx - target.boardX) < SPX * 0.5
&& Math.abs(cz - target.boardZ) < SPZ * 0.5;
if (FOCUS.on && !_framed) continue; // (the board you are on, full screen: no other board is built, THE BOARD YOU ARE ON, FULL SCREEN)
const boardW = boardWrow0;
const clr = clarityAt(dz, lat);
const bp = cell.row.boardPx; // row-granular: visible set, budget, dot sizing
Expand Down Expand Up @@ -17031,9 +17099,11 @@
const _off = _offFwd(); // −180…180 from forward (the app's own: fwdYaw)
if (Math.abs(_off) > 1) target.yaw = fwdYaw();
// (Oct 31: a double tap on the board already framed, locked and square lets it go; else it frames the board and locks it there)
if (BOARD_LOCK && onFramed && framedAsDefault()){ setBoardLock(false); return; } // (Nov 1: "telling me I just double clicked is stupid": no notice says it)
// (Dec 1: a double click on the board you are on shows it full screen, and again goes back: THE BOARD YOU ARE ON, FULL SCREEN; until then
// it let a framed, square board's lock go, Oct 31, which the menu's Board lock does)
if (onFramed && FOCUS.on){ focusClose(); return; }
if (!onFramed) gotoCell(gx, gz);
zoomBoardToFit();
if (onFramed) focusOpen(); else zoomBoardToFit();
target.active = true;
PAN.vx = PAN.vz = 0; setBoardLock(true);
/* …AND AN APP THAT PLAYS ON ITS FIRST TAP STARTS HERE TOO (Nov 2: "in mini-golf double click should set the golf-hole current. user
Expand Down Expand Up @@ -18003,6 +18073,7 @@
_uiDt = dt; // real frame time, for anything rate-independent

updatePanInertia(dt); // release glide from a swipe or a pan-mode drag
focusTick(); // (the board you are on, full screen: the sheet's hole follows it, Dec 1)
syncBrowserVisibility(); // the strip steps aside while a game is live

// Time-dilation tick — accumulate the share of this frame "lost" to the
Expand Down Expand Up @@ -18207,7 +18278,7 @@
up, which is exactly the job it was written for. (It was hidden while
we were isolating the shader precision bug; that is fixed, and it now
carries the per-axis pitch like everything else.) */
_fb.visible = true;
_fb.visible = !FOCUS.on; // (not while the board you are on is shown full screen, Dec 1)
}
if (window.LAB && window.LAB.projection === 'stereo') _stereoRender();
else renderer.render(scene, camera);
Expand Down
24 changes: 24 additions & 0 deletions tests/part5.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,30 @@ const game = { title: 'Words', size: l => 5 + Math.ceil(l / 2),
console.log(`${ok ? 'ok ' : 'FAIL'} ${id}, a double click shows the board alone, full screen: ${on ? on.pieces + ' pieces' + (on.box ? ', in its box' : ', no box') + ', "' + on.title + '…"' : 'not opened'}; shut by a double click ${off}`);
}

// (Dec 1: "Could we add double click to full screen to the games to?", "Playable focus"): a real double click on the board you are on shows it
// alone and large, the page's controls away and no other board built; a real tap on it still reaches the game; a tap off it selects nothing;
// a double click on it again, or Escape, brings the field back
for (const id of ['checkers', 'minigolf', 'tetris']){
current = id;
await page.evaluate(id => window.setFieldApp(window.FIELD_APPS.find(a => a.id === id)), id);
await drawn(page, 2500); await page.evaluate(() => window.__settle());
const p = await page.evaluate(() => window.__aim(8, 3, 3));
await page.mouse.dblclick(p.x, p.y); await drawn(page, 2500); await page.evaluate(() => window.__settle());
const on = await page.evaluate(() => ({ on: window.fieldFocus.on, menu: getComputedStyle(document.getElementById('menuBtn')).display, fabric: window.__fieldFabric ? window.__fieldFabric.visible : null }));
// (a tap on the board reaches the game; one in a corner of the screen, off the board, reaches nothing)
await page.evaluate(() => { const A = window.getFieldApp(); window.__taps = 0; window.__tapOrig = A.onCellTap; A.onCellTap = function(...a){ window.__taps++; return window.__tapOrig ? window.__tapOrig.apply(this, a) : false; }; });
const q = await page.evaluate(() => window.__aim(8, 4, 5));
await page.mouse.click(q.x, q.y); await drawn(page, 900);
await page.mouse.click(8, 8); await drawn(page, 600);
const taps = await page.evaluate(() => { const A = window.getFieldApp(); A.onCellTap = window.__tapOrig; return window.__taps; });
if (id === 'tetris'){ await page.keyboard.press('Escape'); } else { const r = await page.evaluate(() => window.__aim(8, 3, 3)); await page.mouse.dblclick(r.x, r.y); }
await drawn(page, 2000);
const off = await page.evaluate(() => ({ on: window.fieldFocus.on, menu: getComputedStyle(document.getElementById('menuBtn')).display, fabric: window.__fieldFabric ? window.__fieldFabric.visible : null }));
const ok = p.ok && on.on && on.menu === 'none' && on.fabric === false && taps >= 1 && !off.on && off.menu !== 'none' && off.fabric !== false;
if (!ok) failures.push('[focus] ' + id + ' ' + JSON.stringify({ p, on, taps, off }));
console.log(`${ok ? 'ok ' : 'FAIL'} ${id}, a double click on the board you are on shows it full screen: ${on.on ? 'on' : 'off'}, the menu ${on.menu}; taps reaching the game ${taps}; ${id === 'tetris' ? 'Escape' : 'a double click'} back: ${off.on ? 'still on' : 'off'}`);
}

} catch (e){
failures.push(`[${current}] ${e.message}`);
}
Expand Down
Loading