P9.1: visual polish — frame the board off the screen bezel (sx, iOS sim)
Polish pass before final acceptance. The 8x8 grid was rendering flush to the left/right screen edges (gems ~4pt from the bezel on iPhone 17). Add a content margin (BOARD_INSET_X = 16pt) layered on top of the platform safe-area insets so the grid is framed by the background, while the HUD keeps using the bare safe insets so it still hugs the top below the Dynamic Island. The grid is width-constrained in portrait, so this inset is what sizes it; vertical centering inside the safe area is unchanged, and the win/lose banner (derived from the grid) stays centered over the framed board. Safe-area verified on a current iPhone simulator (iPhone 17, iOS 26): HUD below the Dynamic Island, board far above the home indicator, forced win/lose banners centered and unclipped. The headless geometry tests (hit_test, banner_layout) call compute() with a zero inset directly, so they are unaffected; full logic gate stays green (18/18). Goldens: add p9_polish.png (resting board, M3TE_ANIM_TIME=0) as the canonical polished layout. Re-capture the README-documented deterministic goldens whose board position shifts by the 16pt margin (p4_board, p4_hud, p6_idle_t0, p6_idle_mid, p6_select, p7_win, p7_lose, p7_restart). The in-flight move-timeline goldens (p5_swap_*, p6_anim_*, p6_fx_*, p6_inputlock_board) and the p0 quad goldens are not reproducible via the documented env pins (which pin only the idle clock + level state), so they are left as-is.
This commit is contained in:
@@ -27,6 +27,12 @@
|
||||
// inside its cell tile rather than touching the tile's edges.
|
||||
GEM_FILL_FRAC :f32: 0.84;
|
||||
|
||||
// Content margin layered on top of the platform safe-area insets: frames the
|
||||
// grid off the left/right screen bezel so the gems aren't flush to the edge.
|
||||
// The grid is width-constrained on a portrait phone, so this is the inset that
|
||||
// actually sizes it; vertical centering inside the safe area is unchanged.
|
||||
BOARD_INSET_X :f32: 16.0;
|
||||
|
||||
// Selection overlay: a translucent warm fill plus a bright opaque rim around the
|
||||
// chosen cell. `add_stroked_rect` draws the rim in its FILL color (the renderer
|
||||
// ignores the separate stroke color), so SELECT_RIM is passed as the fill.
|
||||
@@ -204,7 +210,20 @@ BoardView :: struct {
|
||||
layout: BoardLayout;
|
||||
|
||||
compute_layout :: (self: *BoardView, frame: Frame) {
|
||||
self.layout.compute(frame, self.safe);
|
||||
self.layout.compute(frame, self.content_insets());
|
||||
}
|
||||
|
||||
// Platform safe-area insets widened by the content margin, so the grid (and
|
||||
// the hit-test / banner geometry derived from it) is framed off the screen
|
||||
// bezel. The HUD keeps using the bare safe insets, so it still hugs the top
|
||||
// below the notch / Dynamic Island rather than shifting in with the board.
|
||||
content_insets :: (self: *BoardView) -> EdgeInsets {
|
||||
EdgeInsets.{
|
||||
top = self.safe.top,
|
||||
left = self.safe.left + BOARD_INSET_X,
|
||||
bottom = self.safe.bottom,
|
||||
right = self.safe.right + BOARD_INSET_X,
|
||||
}
|
||||
}
|
||||
|
||||
// Draw gem `gem_index`'s sprite-sheet column into `gf`.
|
||||
|
||||
Reference in New Issue
Block a user