Skip to content

fix(core): prevent gaps in scaled rounded boxes#148

Merged
doodlewind merged 2 commits into
pocket-stack:mainfrom
odex21:codex/fix-scaled-rounded-box-gaps
Jul 22, 2026
Merged

fix(core): prevent gaps in scaled rounded boxes#148
doodlewind merged 2 commits into
pocket-stack:mainfrom
odex21:codex/fix-scaled-rounded-box-gaps

Conversation

@odex21

@odex21 odex21 commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • quantize a flat rounded box's shared outer edges once before splitting it into corner quads and rectangular bands
  • clamp the destination corner radius to the quantized dimensions
  • add a raster regression for a scaleX/scaleY 0.96 rounded box

Root cause

The flat rounded-box fast path emitted four textured corners and three rectangles from fractional transformed coordinates. DrawList stores integer positions and integer sizes, so independently rounding each piece's start and extent could leave adjacent pieces one pixel apart. A pressed button using scale: 0.96 exposed the gaps as a black cross through its background.

The fix quantizes the outer boundaries once and derives every piece from those same boundaries. The fast path still emits the same seven draw operations and performs no additional allocation.

Visual comparison

Before: pressed button in the Gesture page After: isolated pressed rounded box with the core fix
rounded-box-scale-before rounded-box-scale-after

Validation

  • cargo test --manifest-path core/Cargo.toml scaled_flat_rounded_box_has_no_gaps_between_fast_path_pieces -- --nocapture
  • cargo test --manifest-path core/Cargo.toml (82 passed)
  • reproduced in the Web host with Vue SFC and TSX versions of the same scaled rounded button

@odex21
odex21 marked this pull request as ready for review July 22, 2026 12:35
@odex21
odex21 marked this pull request as draft July 22, 2026 12:36
@odex21
odex21 marked this pull request as ready for review July 22, 2026 12:53

@doodlewind doodlewind left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed and verified locally after resolving the #149 restructure conflict (merged main; the fix now lives at engine/core/src/draw.rs).

  • Root cause confirmed: xy_word/wh_word round each piece's position and extent independently, so fractional transformed edges let adjacent fast-path pieces disagree by 1px. Quantizing the four outer edges once and deriving all seven pieces from them is the right fix, and the added rf clamp correctly guards the degenerate case where quantization shrinks the box below 2r.
  • Verified the regression test fails against the unfixed draw.rs and passes with the fix.
  • cargo test (engine/core): 82/82. Full bun run test suite: pass. tape:check: 180/180 hero frames unchanged — integer-coordinate output is byte-identical, as intended.

@doodlewind
doodlewind merged commit de8d892 into pocket-stack:main Jul 22, 2026
doodlewind added a commit that referenced this pull request Jul 23, 2026
- bump package.json, tools/cli/package.json, pocket.json to 0.7.0
- changelog: 0.7.0 entry (Pocket Vapor GBA/GB/NES + ESP32, boards as data
  + execution classes, Cover Flow launcher, .pocket v1, widget family,
  Vita GXM, Vue SFC + 3.6.0-rc.1, contracts semantics as fields)
- fix tools/pocket-pack.ts section-kind inference (release tsc gate;
  regressed unobserved when #139 added the cover section after v0.6.0)
- re-bake 7 web goldens stale since #148's scaled rounded-box gap fix
  (gallery x5, music.60, motions.236) — 49/49 green

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
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.

2 participants