8000 fix(timeline): grid-snap on pill drag by johannboehme · Pull Request #33 · johannboehme/tk-1 · GitHub
[go: up one dir, main page]

Skip to content

fix(timeline): grid-snap on pill drag - #33

Merged
johannboehme merged 1 commit into
mainfrom
claude/fix-pill-drag-snap
May 6, 2026
Merged

johannboehme merged 1 commit into
mainfrom
claude/fix-pill-drag-snap

Conversation

@johannboehme
Copy link
Copy Markdown
Owner

Summary

Pill body-drag (`pill-move`) had no grid snap — only edge-to-edge magnetic snap to neighbour pills — so changing snap mode to "1" / "1/4" / etc. felt identical to OFF when moving a pill. User-reported regression after #32 made pills universal in direct-mode.

Also fixes a latent domain bug in pill-trim-in / pill-trim-out: they passed arr-time `arrAtPointer` to `snapped()` which interprets master-time. Identity in single-take's whole-master segment (so it was accidentally correct there), double-projected and wrong in long-form.

Fix

  • New helper `snappedArr(arrT, e)` — same snap pipeline as `snapped()` but the input is already arr-time, so no master↔arr roundtrip.
  • `pill-move`: apply `snappedArr` on top of the existing edge-to-edge magnet (grid snap as primary, neighbour-edge as override when very close).
  • `pill-trim-in` / `pill-trim-out`: replace `snapped()` calls with `snappedArr` to fix the long-form domain bug.

`pill-move` with snap mode OFF or MATCH passes through unchanged (MATCH triggers the separate `cam-track-move` kind).

Test plan

  • `pnpm test --run`: 935 passing, no new tests needed (existing snap.ts unit tests + integration through Timeline)
  • `pnpm tsc --noEmit`: clean
  • Manual: dragged pill in 2-cam direct-mode job locally
    • Snap "1" + BPM 120, beat-phase 0.428 → pill arrStart landed exactly at 10.428 (= bar 6) ✅
    • Snap OFF → pill arrStart 11.95 (free, between bars) ✅

🤖 Generated with Claude Code

Pill body-drag (`pill-move`) only had edge-to-edge magnetic snap to
neighbour pills — no grid snap, even with snap mode "1" / "1/4" /
etc. Pre-refactor the symptom was hidden because pills only existed
in arr-mode; after #32 made pills universal, single-take drag
exposes the gap.

Pill-trim-in / pill-trim-out called `snapped(arrAtPointer, e)` but
`arrAtPointer` is arr-time and `snapped()` interprets master-time.
Identity in single-take's whole-master segment, double-projected
(broken) in long-form.

Fix: introduce `snappedArr(arrT, e)` — same snap pipeline but the
input domain is arr-time. Apply to pill-move (new grid snap on top
of the existing edge-to-edge magnet) and pill-trim-{in,out} (replace
the master-domain `snapped()` with the arr-domain helper).

Verified locally: pill-move with snap "1" lands on bar boundaries;
snap OFF passes through unchanged; existing 935 tests still pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@johannboehme
johannboehme merged commit 66fcbe2 into main May 6, 2026
1 check passed
@johannboehme
johannboehme deleted the claude/fix-pill-drag-snap branch May 6, 2026 17:47
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