Tray pieces now render at a usable minimum size instead of shrinking… #4
Loading…
Reference in a new issue
No description provided.
Delete branch "osf/179-feedback-to-implement-puzzle-game"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was done
How to review
origin/mainto see the change — it spans the tray layout math, the drop logic, the game and tray components, the firework audio, and the README.npm test,npm run typecheck,npm run lint, andnpm run build— all four should pass.npm run devand open the printed URL — you should see the setup screen (an image gallery, difficulty options, and a "Start puzzle" button that is disabled until you pick an image).src/lib/layout.tsandsrc/hooks/usePuzzle.tsfirst — the minimum-scale and content-vs-panel geometry, and the nearest-empty-slot drop logic, live there.Code review
Reviewed the tray-scroll/slot-drop/firework change against its proposal, spec delta, design and tasks: geometry floor (TRAY_MIN_SCALE), nearest-free-slot reducer rule, scroll offset + bounding rule, scrollbar UI and re-synthesized firework all match the spec, the commit is clean (no artifacts; dist/ is gitignored), and the new tests assert what they are named for. Fixed two bugs in Game.tsx: the pointer→field conversion keyed the scroll offset on the pointer while the render shift keyed on the piece position, so dragging across the tray's x edges jumped the piece by the full scroll amount (now both key on the piece position, including the grab offset); and a non-snapping drop in the strip below the panel could rest in a slot just outside the visible window, leaving the piece unrendered (the drop now nudges trayScroll so the rest slot is inside the window). Full gate re-run after the fixes: 52/52 tests, typecheck, lint and build all pass.
Fixed before the commit
src/components/Game.tsx:130: toField added trayScroll when the POINTER was inside the tray column, but the render shift applied when the PIECE's x was inside it. With any non-zero grab offset the two disagree in a window of width |dx| around the tray's left/right x edges, so dragging a tray piece toward the board (or a board piece into the tray) with the tray scrolled made the rendered y jump by the full trayScroll (up to ~444 field units at 12x12) mid-drag — violating task 3.2's 'no jump at the boundary'. Fixed: toField now probes the piece's would-be position (pointer minus grab offset) while dragging, and handlePiecePointerDown keys the grab offset on the piece's side of the column, so conversion, render shift and the reducer's drop rule all agree on one point and the piece follows the pointer continuously.src/components/Game.tsx:175: A non-snapping drop in the tray column rests in the nearest free slot, but a drop in the 40-unit strip below the tray panel (reachable by dragging to the bottom margin) has its nearest slot just below the visible window when scroll is near 0 — the piece then rendered nowhere until the user scrolled, contradicting the design's invariant that a piece never comes to rest invisible. Fixed: after such a drop the pointer-up handler recomputes the same nearestFreeSlot the reducer uses and nudges trayScroll minimally (clamped to [0, maxScroll]) so the rest slot is inside the panel window; drops whose slot is already visible change nothing.Tests
All 8 scenarios of
feedback-to-implement-puzzle-game-1-piec-w47x98have a tagged test.The test lint recorded nothing in the run's tests.
Braid run
feedback-to-implement-puzzle-game-1-piec-w47x98(34 steps, 1 retried).forgejo/workflows,.gitea/workflowsor.github/workflows); what only CI tests went unverifiedOpened by Braid.