Skip to content

feat(renderer): rotated labels on mixed-zone cards - #66

Merged
LeslieOA merged 1 commit into
developfrom
fix/rotated-labels-mixed-zone
Jun 1, 2026
Merged

feat(renderer): rotated labels on mixed-zone cards#66
LeslieOA merged 1 commit into
developfrom
fix/rotated-labels-mixed-zone

Conversation

@LeslieOA

@LeslieOA LeslieOA commented Jun 1, 2026

Copy link
Copy Markdown
Member

Summary

cc-label-left / cc-label-right rotated 90° only on label-only cards. On mixed-zone cards (a label combined with body / header / footer) the label fell back to horizontal — because its rotation <Group transform> had to sit inside SkiaTextRenderer's multi-zone elements array, and <Group transform> is a no-op when nested in an element array (react-native-skia limitation, #96).

Closes #64 (split out from #53).

Fix

  • New SkiaCardLabelRenderer — returns the rotated label as its own top-level <Group transform>, rendered as a sibling in SkiaCanvasLayer. Top-level placement is what makes the transform apply (same principle as the label-only early-return that already worked). Handles all side labels — label-only and mixed alike — and clips to the card outline (reuses #53a's shapeClipPath).
  • SkiaTextRenderer no longer renders labels: removed the label-only early-return and the horizontal mixed-zone fallback (plus the now-unused getLabels import + labels memo). Draws header / footer / body only.
  • Picture path (drawTextNode): replaced the label-only special-case with a unified loop drawing every label rotated, for both label-only and mixed cards — keeps the pinch overlay pixel-identical to the live tree.

Why low-risk

  • The rotation maths is unchanged — lifted verbatim from the working label-only path, just relocated to a top-level return.
  • Label-only cards: SkiaTextRenderer now returns null for them (empty elements), and the label renderer draws them — net-identical output.
  • typecheck / lint / 48 tests all green.

Test plan

  • On-device: a card with both a cc-label-left and body text shows the label rotated 90° (previously horizontal). Candy label fixtures: Headers and Labels.canvas, candy-feature-*.
  • Label-only cards still rotate correctly (no regression).
  • Left + right labels on the same card both rotate.
  • Pinch-zoom: Picture overlay matches the live tree (no label flip/flash).

🤖 Generated with Claude Code

…erer (#64)

`cc-label-left` / `cc-label-right` only rotated on label-*only* cards. On
mixed-zone cards (label + body / header / footer) the label fell back to
horizontal, because its rotation `<Group transform>` had to sit inside
SkiaTextRenderer's multi-zone `elements` array — and Group transform is a
no-op when nested in an element array (react-native-skia limitation, #96).

Fix: extract a dedicated `SkiaCardLabelRenderer` that returns the rotated
label as its own top-level Group, rendered as a sibling in SkiaCanvasLayer.
Top-level placement is what makes the transform apply (same principle as the
label-only early-return that already worked). It now handles ALL side labels —
label-only and mixed alike — and clips to the card outline (rect or shape path,
reusing #53a's `shapeClipPath`).

SkiaTextRenderer no longer renders labels at all: removed both the label-only
early-return and the horizontal mixed-zone fallback, plus the now-unused
`getLabels` import and `labels` memo. It draws header / footer / body only.

Picture path (`useCanvasPicture.drawTextNode`) updated to match: replaced the
label-only-special-case rotation block with a unified loop that draws every
label (left + right) rotated, for both label-only and mixed cards, so the
pinch overlay stays pixel-identical to the live tree (two-paths-in-sync rule).

Closes #64.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@LeslieOA
LeslieOA merged commit 25a1a0a into develop Jun 1, 2026
1 check passed
@LeslieOA
LeslieOA deleted the fix/rotated-labels-mixed-zone branch June 1, 2026 19:27
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.

feat(renderer): rotated labels on mixed-zone cards (cc-label + body/header/footer)

1 participant