8000 fix(timeline): trim chrome per arr-time occurrence by johannboehme · Pull Request #34 · johannboehme/tk-1 · GitHub
[go: up one dir, main page]

Skip to content

fix(timeline): trim chrome per arr-time occurrence - #34

8000
Merged
johannboehme merged 1 commit into
mainfrom
claude/fix-trim-chrome-occurrences
May 6, 2026
Merged

johannboehme merged 1 commit into
mainfrom
claude/fix-trim-chrome-occurrences

Conversation

@johannboehme
Copy link
Copy Markdown
Owner

Summary

Trim is master-time, the audio canvas is arr-time. A chunk repeated N times in long-form gives the trim master-time N arr-time occurrences. After #32, the dim-band and handles only rendered at `min(in)..max(out)` — one block spanning the whole song with handles only at the earliest/latest occurrence.

User feedback: pills are instances of chunks in lanes, and operations should treat each instance independently. Trim chrome should reflect that.

Fix

  • Dim path uses `sliceByArrSegments(trim.in, trim.out, segments)` to compute the playable arr-time slices. Everything outside any slice gets dimmed. Trim entirely outside all segments → whole canvas dimmed (correct edge case).
  • Trim handles render at every `mastersToArrAll(trim.in / trim.out)` arr-occurrence. Off-canvas positions clip out.
  • `classifyAudioHit` walks all occurrences and reports `trim-in` / `trim-out` if any handle is within `HANDLE_HIT` of the pointer. Drag handler unchanged — it sets master-trim directly, so dragging any one handle moves all visual handles in lockstep.

Single-take + long-form-without-duplicates: byte-identical to pre-fix (one occurrence per trim-bound). Long-form-with-duplicates: visually truthful + every handle is grabbable.

Verified

  • 935 tests pass, tsc clean
  • JS-level data check on a synthetic 3×duplicate arrangement with master-trim={5,10}: `mastersToArrAll(5) = [5, 35, 65]`, `mastersToArrAll(10) = [10, 40, 70]`, `sliceByArrSegments` returns 3 slices. Rendering loops iterate over those exact arrays.

🤖 Generated with Claude Code

Trim is master-time, but the audio canvas runs in arr-time. With a
chunk repeated N times in a long-form arrangement, the trim master-
time has N arr-time occurrences. After #32, the trim-dim band and
handles only rendered at min(in)..max(out) — one big region spanning
the whole song with handles only at the earliest/latest occurrence.
That's wrong: the un-trimmed parts of repeated chunks didn't get
dimmed, and only one of the N pairs of handles was draggable.

Fix:
- Dim path uses sliceByArrSegments(trim.in, trim.out, segments) to
  get the playable arr-time slices directly. Everything outside any
  slice is dimmed. Trim entirely outside all segments → whole canvas
  dimmed. Per-occurrence dim bands fall out for free.
- Handles render at every mastersToArrAll(trim.in/out) occurrence.
  All clipped to canvas extent; off-screen positions don't render.
- classifyAudioHit walks all occurrences of trim.in / trim.out and
  reports trim-in / trim-out on hit at any of them. Drag handler
  unchanged — it sets master-trim, so dragging any occurrence moves
  every visual handle in lockstep.

Single-take and long-form-without-duplicates: identical to before
(one occurrence each). Long-form-with-duplicates: now visually
truthful + interactable at every chunk repeat.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@johannboehme
johannboehme merged commit 5a4caa4 into main May 6, 2026
1 check passed
@johannboehme
johannboehme deleted the claude/fix-trim-chrome-occurrences branch May 6, 2026 17:54
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.

1 participant

0