feat(renderer): rotated labels on mixed-zone cards - #66
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
cc-label-left/cc-label-rightrotated 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 insideSkiaTextRenderer's multi-zoneelementsarray, 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
SkiaCardLabelRenderer— returns the rotated label as its own top-level<Group transform>, rendered as a sibling inSkiaCanvasLayer. 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'sshapeClipPath).SkiaTextRendererno longer renders labels: removed the label-only early-return and the horizontal mixed-zone fallback (plus the now-unusedgetLabelsimport +labelsmemo). Draws header / footer / body only.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
SkiaTextRenderernow returns null for them (empty elements), and the label renderer draws them — net-identical output.Test plan
cc-label-leftand body text shows the label rotated 90° (previously horizontal). Candy label fixtures:Headers and Labels.canvas,candy-feature-*.🤖 Generated with Claude Code