Skip to content

fix(minesweeper): board scaling + reveal/flag mode toggle (#278 Tier-0) - #282

Merged
wei18 merged 2 commits into
mainfrom
fix/ms-board-scaling-flag-toggle-278-tier0
Jun 3, 2026
Merged

wei18 merged 2 commits into
mainfrom
fix/ms-board-scaling-flag-toggle-278-tier0

Conversation

@wei18

@wei18 wei18 commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Refs #278 (Tier-0 of the Designer critique — Tier-1 theme extraction + Tier-2 polish remain tracked on the issue).

Fixes the 3 theme-independent Blockers:

  • Board scaling: MinesweeperBoardView board grid now sizes via GeometryReader — cellSide derived from the offered rect, fitting the non-square board (Expert 16×30) by its longer axis; glyph size tracks cellSide. No more 960pt overflow.
  • Tap-target floor + scroll: below a 32pt cell floor the board scrolls both axes instead of shrinking into un-tappable cells.
  • Discoverable reveal/flag mode toggle: on-screen segmented Picker (modeled on Sudoku's pencil toggle); long-press (iOS) / right-click (Mac) kept as accelerators — Mac users no longer depend on an invisible right-click.

Code Review: REQUEST-CHANGES → resolved. Two CR findings fixed: (1) iOS .flag-mode long-press double-toggle (long-press now only flags in .reveal mode); (2) fitted board was pinned top-leading — now centered in the offered rect (mirrors Sudoku BoardView), scrolling only when clamped. CR confirmed the GeometryReader + .aspectRatio sizing is sound (no collapse/starve — same proven pattern Sudoku ships).

Verified: MinesweeperKit builds + 34 tests pass.

🤖 Generated with Claude Code

wei18 and others added 2 commits June 3, 2026 17:15
Tier-0 UX blockers from the Designer critique (#278), all in
MinesweeperBoardView. Three coupled fixes, one dispatch:

#1 Board scaling. The cell button was hardcoded frame(30,30) inside a
naked VStack/HStack with no GeometryReader, so Expert (16x30 ~ 960pt)
overflowed every iPhone and most Mac windows. The grid is now wrapped in
a GeometryReader that derives a single square cell side fitting the
NON-square board by its longer axis:
  cellSide = floor(min(availW/cols, availH/rows))
where availW/availH subtract the inter-cell spacing first. The cell
frame and the number/flag/mine glyph (font ~ cellSide * 0.55, replacing
the literal 16) both scale from it.

#2 Tap-target floor. minCellSide = 32pt. When the fitted side would drop
below the floor (e.g. Expert on iPhone fits ~10pt), cellSide is clamped
to 32 and the board scrolls (ScrollView([.horizontal,.vertical]))
instead of shrinking into an un-tappable grid. When it fits, the
ScrollView is inert.

#3 Discoverable reveal/flag toggle. Added an on-screen segmented Picker
(Reveal / Flag) above the board, modeled on Sudoku's pencil-mode toggle.
In Flag mode a tap flags; in Reveal mode a tap reveals. Long-press (iOS)
and right-click contextMenu (Mac) stay as flag accelerators in either
mode — Mac users no longer depend on an invisible right-click. Mode is
view-local @State (no engine semantics). Added .contentShape(Rectangle)
so the whole cell square is hit-testable.

Deferred: Tier-1 theme tokens, Tier-2 Mac side-rail (#6), win/lose
overlay (#7), VoiceOver (#10), .task loop cleanup (#9) — separate
dispatches.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
…entering

CR REQUEST-CHANGES:
- iOS .flag-mode long-press double-toggle: in .flag mode the button tap +
  long-press both fired onToggleFlag, netting a no-op. Long-press now only
  flags in .reveal mode (redundant in .flag mode where tap already flags).
- Fitted board was pinned top-leading; now center the floored grid in the
  offered rect (mirrors Sudoku BoardView), only scrolling when clamped to floor.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@wei18
wei18 merged commit f29f212 into main Jun 3, 2026
@wei18
wei18 deleted the fix/ms-board-scaling-flag-toggle-278-tier0 branch June 3, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant