Skip to content

nationalday: center short lists that don't scroll - #584

Merged
tavdog merged 2 commits into
tronbyt:mainfrom
jvivona:nationalday-center-nonscroll
Jul 9, 2026
Merged

nationalday: center short lists that don't scroll#584
tavdog merged 2 commits into
tronbyt:mainfrom
jvivona:nationalday-center-nonscroll

Conversation

@jvivona

@jvivona jvivona commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Problem

The article area of National Day is a vertical render.Marquee. When the day's list is short enough to fit (1–4 items, depending on wrapping and 1x vs 2x), the marquee doesn't scroll — and on that path it pins the child at offset = 0. The result is text flush against the title bar with a block of dead space underneath.

Fix

Pass align = "center" to the marquee. It only consults Align inside the cw <= size branch of Marquee.Paint, so this is inert whenever the content actually scrolls.

Second, displayItem() appended a spacer after every item, including the last. That trailing spacer is measured as part of the column the marquee centers, so align alone still left the text high by SPACER_HEIGHT / 2. Emitting the spacer only between items makes the gaps exactly symmetric. Its only other effect was a few all-black tail frames on the scroll, which libwebp coalesced anyway.

Verification

Rendered against the live feed on pixlet v0.52.0, at 1x and 2x:

mode items before after
day 2 static, gaps 0/8 static, gaps 4/4
week 1 static, gaps 0/19 static, gaps 9/10
month 17 scrolls, 268 frames scrolls, 268 frames

"gaps" = pixel rows of empty space above/below the text block inside the article area.

For the scrolling case I decoded all 268 frames of the month feed at both resolutions and diffed them: every frame is pixel-identical to the pre-change render. The loop is 400 ms shorter (27300 → 26900 ms), which is the four black tail frames the trailing spacer used to contribute.

Confirmed on real hardware at 1x and 2x.

pixlet format / lint / check all clean. Previews aren't regenerated: they were rendered on a day when the feed was long enough to scroll, and the scrolling path is unchanged, so they remain accurate — regenerating today would just swap in a static 2-item still.

🤖 Generated with Claude Code

The article area is a vertical render.Marquee. When the content fits, the
marquee doesn't scroll and pins the child at offset 0, so a 1-4 item list
sat flush against the title bar with dead space below.

Pass align = "center", which the marquee only consults on the non-scrolling
path (`cw <= size`). Scrolling output is unchanged: every frame of the
17-item month feed renders pixel-identical at 1x and 2x.

Also emit the item spacer only between items rather than after every item.
The trailing spacer is measured as part of the column, so centering the
child left the text high by SPACER_HEIGHT/2 (a 4px gap asymmetry at 1x).
With it gone the gaps above/below are exactly equal. Its only other effect
was 4 all-black tail frames on the scroll, which libwebp coalesced anyway;
the month loop is now 400ms shorter with identical frames.

Verified against the live feed at 1x and 2x:
  day  (2 items)  static  gaps 4/4  (was 0/8)
  week (1 item)   static  gaps 9/10 (was 0/19)
  month (17)      scrolls, 268 frames, pixel-identical before/after

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jvivona
jvivona requested a review from tavdog as a code owner July 9, 2026 11:31

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the version number, adds center alignment to the marquee component, and refactors the spacer logic in displayItem to prevent trailing spacers. There is no feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@tavdog

tavdog commented Jul 9, 2026

Copy link
Copy Markdown
Member

How did claude do this "Confirmed on real hardware at 1x and 2x."

@tavdog
tavdog merged commit eb535a5 into tronbyt:main Jul 9, 2026
@jvivona

jvivona commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

he did not. I did it this morning on my Dev s3 wide & my s3

I gotta 'coach him up' a little better on comments.

he does create webp files for me to review in 1x & 2x - but can't do the rest. caught him putting in a background color in another app that didn't really show up until it got on physical devices.

@jvivona
jvivona deleted the nationalday-center-nonscroll branch July 9, 2026 18:33
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