8000 feat(transport): contextual I/O hotkeys + stale-drag fix by johannboehme · Pull Request #22 · johannboehme/tk-1 · GitHub
[go: up one dir, main page]

Skip to content

feat(transport): contextual I/O hotkeys + stale-drag fix - #22

Merged
johannboehme merged 2 commits into
mainfrom
claude/eager-dubinsky-62f1b9
May 2, 2026
Merged

johannboehme merged 2 commits into
mainfrom
claude/eager-dubinsky-62f1b9

Conversation

@johannboehme
Copy link
Copy Markdown
Owner

Summary

  • I/O hotkeys + IN/OUT buttons are now contextual. When a video clip is selected, I/O set its trimInS/trimOutS at the playhead (clamped to [0, sourceDurationS]). When an image clip is selected, they move the pill's left/right edge to the playhead — same semantics as the move-mode trim handles. Loop-mode behavior is unchanged; with no clip selected they continue to set the master export trim.
  • Whole timeline lane is selectable. Previously only the pill itself selected a clip, so parking the playhead outside the pill and then selecting the clip was a chicken-and-egg — every click moved the playhead back into the pill. Now clicking anywhere in a lane selects that lane's clip and seeks to the click.
  • Stale-drag fix across timeline + FX panel. When a drag's pointerup was lost off-window, dragRef/startRef/dragging stayed armed and the next move snapped the element back to the cursor as if the user were still holding the button. Two defensive layers: an e.buttons === 0 guard at the top of every onPointerMove, and window-level pointerup/pointercancel/blur listeners. Applied to Timeline (trim/clip-move/loop/scrollbar), ADSR knots, and FX encoder knobs.

The routing + math for the new I/O behavior live in a pure io-points.ts module with 18 unit tests covering the type-discriminator, anchor-relative source-time conversion (with/without sync offsets and trim), and the image-edge geometry.

Test plan

  • npm run lint clean
  • npm run test — 728/728 pass (18 new for io-points)
  • Manual: master selected (or none) → I/O move master-trim markers (regression check).
  • Manual: video selected → playhead inside clip → I/O set trim handles to playhead. Playhead before clip → I clamps to source 0. Playhead past source-end → O clamps to sourceDurationS.
  • Manual: image selected → I moves left pill edge to playhead (right fixed); O moves right edge (left fixed); 0.1 s min-pill enforced.
  • Manual: Loop active → I/O editieren weiter Loop-Grenzen unabhängig von Selektion.
  • Manual: click anywhere in a video/image lane (not on the pill) → that clip becomes selected.
  • Manual stale-drag check: start dragging a trim handle → drag cursor outside the browser window → release the mouse there → move cursor back over the timeline. Element should NOT snap to the cursor. Same check on an ADSR knot and an FX encoder knob.

🤖 Generated with Claude Code

johannboehme and others added 2 commits May 2, 2026 23:54
I/O were master-trim-only regardless of selection. Now they route
contextually so the user can sculpt per-clip in/out without leaving
the keyboard:

- Loop active        → loop boundaries (unchanged)
- Video selected     → trimInS / trimOutS at playhead, clamped to
                        [0, sourceDurationS] by setVideoClipTrim
- Image selected     → master-pill edges (mirrors the move-mode
                        drag handles' image-resize semantics)
- Else               → master trim (unchanged)

Routing logic + source-time/anchor math live in a new pure module
io-points.ts with 18 unit tests; TransportBar imports the helpers.
aria-labels and shortcut hints reflect the active context.

To make the new hotkey usable, the timeline lanes are now selectable
on their full width — clicking anywhere in a clip's lane (not just
on the pill) selects that clip. Without this, parking the playhead
outside a pill and then selecting the clip was impossible — the
required click would always re-seek into the pill first.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
setPointerCapture should route pointerup to the captured element
regardless of cursor position, but the up event can be lost when
the cursor leaves the browser window or the OS swallows it. The
drag state stays armed and the next pointermove over the surface
snaps the trim/clip/knot back to the cursor as if the button were
still held — visible to the user as "the element keeps following
the mouse after a drag-and-release-outside".

Two defensive layers, applied to every drag surface known to
exhibit the symptom:

- e.buttons === 0 guard at the top of onPointerMove. If we have
  an armed drag but no button is pressed, the up was missed —
  clear and treat the event as hover.
- window-level pointerup / pointercancel / blur listener as
  belt-and-suspenders for releases that happen outside the
  document entirely.

Surfaces patched:
  - Timeline canvas (trim, clip-move, loop, scrollbar drags)
  - FxHardwarePanel ADSR knots
  - FxHardwarePanel encoder knobs

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@johannboehme
johannboehme merged commit 4f1e7eb into main May 2, 2026
1 check passed
@johannboehme
johannboehme deleted the claude/eager-dubinsky-62f1b9 branch May 2, 2026 21:55
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