fix(liars-dice): stack cups on narrow screens instead of clipping them - #55
Merged
Conversation
On a phone the anchor seat's cup rendered as 4+1 while the two opponents kept 5 across. The anchor station is absolutely positioned with `left:50%;transform:translateX(-50%)`, and an absolutely positioned box shrink-to-fits against the room from its `left` edge to the containing block's right edge — so `left:50%` capped it at HALF the stage (~183px on a 390px viewport) and the transform came too late to help. The two top stations, meanwhile, are 220px each at `left:2%` / `right:2%`, which overlap once the stage drops under ~450px. Centre by spanning the stage (`left:0;right:0` + a flex wrapper) rather than by 50%+transform, and give each top station half the stage as its width budget. Dice keep their size at every width — whatever doesn't fit on one line moves to the next, dealt into balanced rows, so a cup of 5 reads as 3+2 rather than 4+1. Stacking makes a station taller, and the stage height is fixed (the platform hands the view a 560px iframe; growing it clips the status line), so the felt gives the room up instead: it flattens by exactly the overflow and the centre rides with it, keeping stacked dice off the standing bid. Sizes are baked in at draw time, so also redraw on resize. Verified against the local preview at 320 / 375 / 390 / 450 / 1100 CSS px, on both a bid frame and the taller `LIAR?` reveal frame. Desktop is unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Collaborator
Author
🔍 AI review — external reviewerArena AI Review —
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The bug
On a phone, the anchor seat's cup rendered as 4+1 while the two opponents kept 5 across.
The anchor station is absolutely positioned with
left:50%;transform:translateX(-50%). An absolutely positioned box shrink-to-fits against the room from itsleftedge to the containing block's right edge — soleft:50%capped it at half the stage (~183px on a 390px viewport), and the transform is a paint-time offset that comes too late to affect layout. 183px fits 4 dice (4×34 + 3×5 = 151); the 5th needs 190px, so it wrapped.center()was squeezed by the same rule. And the two top stations are 220px each atleft:2%/right:2%, so they overlap once the stage drops below ~450px.The fix
left:0;right:0+ a flex wrapper) instead of 50%+transform. No more halved width budget.scripts/preview.ts:69, matchingSandboxedGameViewer), so growing the stage just clips the status line. Instead the felt flattens by exactly the overflow and the centre rides with it, keeping stacked dice off the standing bid.Verification
Local
pnpm preview liars-dice, screenshotted at 320 / 375 / 390 / 450 / 1100 CSS px, on both a bid frame and the tallerLIAR?reveal frame:pnpm -F liars-dice typecheckandpnpm validate(11 games / 9 worlds) pass. Onlygames/liars-dice/view.tschanges; no game logic touched.🤖 Generated with Claude Code