Repository navigation
Phones: frame the selected track piece and compact the construction window - #196
Conversation
… window Co-authored-by: Nori <contact@tilework.tech>
Co-authored-by: Nori <contact@tilework.tech>
ProofAll files are at proofs commit Pixel 8 portrait, Edit from this piece (piece 7 of 14)
Short landscape phone (915×412), Edit from this piece
After: Next piece, gap after demolish, and rebuilt circuit (Canvas2D, Pixel 8)
Desktop is unchanged: compare https://raw.githubusercontent.com/tilework-tech/opencoaster/dcaf856ce546924d2b5993833a622da2340fcd2c/pr-196/after/webgl2-desktop-circuit/circuit-selected-full.png with #194's capture of the same view. Mean RGB difference is 0.13, which is the outline pulse. |
Co-authored-by: Nori <contact@tilework.tech>
Live verificationMerged as 152523b. Pages deploy https://github.com/tilework-tech/opencoaster/actions/runs/41459867533 succeeded. The deployed CSS contains the compact-construction rules. Checked on https://opencoaster.noriagentic.com with an emulated Pixel 8, tapping a circuit rail and then Edit from this piece. The ride window closes, piece 7 of 14 is highlighted clear of the construction window, and Previous/Next/Build are fully on screen. Proof commit (immutable): https://github.com/tilework-tech/opencoaster/tree/34ee47a329afd161d8ce203e4112a1443df850f5/pr-196/live
|
Summary
🤖 Generated with Nori
Follow-up to #194/#195. On phones, picking a piece with Edit from this piece left it hidden under the ride and construction sheets, and the camera never framed it. Now you can see the selected piece and its controls together.
Unchanged: track and economy rules, save format, desktop layout.
How it works
src/app/tools/selection-reveal.ts:largestFreeRect, andrevealShift, which uses rail alpha masks so transparent sprite margins don't count.SelectionReveal, driven each frame before the world draw. It waits until window rectangles are stable (window placement happens a few frames late), pans at most twice (first to the projected tile if the piece is off screen, then to its drawn rails), and then stops.CoasterPanel.focusPieceis the one place where the selection changes. It calls the new optionalrevealaction.COMPACT_QUERYlives inwindow-layout.ts. The CSS reorders controls withorderbehind the same media query.Test Plan
pnpm lint,pnpm format:check,pnpm typecheck, andpnpm test(255 files, 2770 tests) pass.selection-reveal.test.ts, 13 tests):e2e/track-edit-selection.spec.ts: 10/10 pass across WebGL2 and Canvas2D × desktop, Pixel 8 portrait and a new Pixel 8 landscape (915×412, touch) run of the circuit flow. Additions:expectPieceUncovered: at least 99% of the selected piece's rail pixels hit the canvas (no sheet or bar over them) and the outline matches the piece. Checked after Edit from this piece, Next and Previous, a demolish and a rebuild.ridePiecesnow reads the snapshot in one evaluation. This fixes an intermittent detached-buffer read I hit once.pnpm e2e:quick: 13 passed, 1 skipped, 1 failed. The failure iscontext-menu"with the patrol tool…", a Chromium Target crashed. It fails identically on cleanmain(7c5857f) in this environment, as Edit coaster track from a selected piece #194 also noted.mobile.spec"is playable on a phone" passes.train-layoutpasses, both Canvas2D and the block-brakes test. They failed once while a second Playwright run was competing for CPU and passed when rerun alone, as they do on main.mobile.spec"guest and footpath controls" and 7starter-ride-accesstests fail identically on clean main in this environment (tile calibration and timeouts, as Edit coaster track from a selected piece #194 noted). CI does not run them.Requested in Nori: https://demo.norisessions.com/chat/01a16c13-c814-7295-9955-b11ff875ed14
Share Nori with your team: https://www.npmjs.com/package/nori-skillsets