Commit 7b2a063
Score: fix loop fresh-start render after tiling refactor
Three regressions stacked from previous commits showed up only on loop
scores at fresh-start (before first play): the music was completely
absent from the visible region — chrome + overlay rendered, the rest
was empty. Once the reader clicked play it recovered, masking the bug.
1. `musicWidth` was using `panRect.width` indiscriminately. For non-loop
that's correct (pan = one continuous piece, sliced or not). For loop
the pan spans N copies side-by-side, so panRect.width was N× too
large. The wrong value broke padAnchors's loop-tail anchor and the
render-loop's wrap math. Use tile0's own bounding rect for loop.
2. The pan's flex children were defaulting to flex-shrink: 1, so when
the pan's containing block (`.score-pan-mask` at 100% of stage =
small) constrained it via shrink-to-fit, three loop copies got
squeezed to ~1/3 their natural width at mount time. tile0's bounding
rect read ~600 px instead of ~1700, throwing musicWidth out by ~3×.
Pin direct svg children to flex-shrink: 0.
3. After the pre-roll removal, fresh-start lands at translateX = +3 px
(first note's natural x sits slightly left of the playhead). The
render loop's `while (translateX > 0)` wrap was firing on that
legitimate tiny positive offset and snapping the pan a full
musicWidth left, hiding the music entirely. Gate the downward wrap
on `wrapOffset !== 0` — only normalize when there's actually
accumulated wrap state from prior iter changes / backward seeks.
All four scores verified at fresh-start: first note's center aligns to
the playhead within sub-pixel rounding. Loop continues to wrap
correctly across iter transitions during sustained playback.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 8b7209b commit 7b2a063
3 files changed
Lines changed: 30 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
226 | 236 | | |
227 | 237 | | |
228 | 238 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
141 | 149 | | |
142 | 150 | | |
143 | 151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1910 | 1910 | | |
1911 | 1911 | | |
1912 | 1912 | | |
1913 | | - | |
1914 | | - | |
1915 | | - | |
1916 | | - | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
1917 | 1921 | | |
1918 | | - | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
1919 | 1925 | | |
1920 | 1926 | | |
1921 | 1927 | | |
| |||
0 commit comments