feat(studio): add timeline pinch zoom#541
Conversation
vanceingalls
left a comment
There was a problem hiding this comment.
Staff review: approved.
The implementation is scoped well: pinch/Ctrl-wheel handling is attached directly to the timeline scroll container with a non-passive native listener, so it can reliably suppress browser zoom without broadening keyboard or page-level behavior. The zoom-anchor helper is testable and preserves the time under the pointer, and the existing fit/manual scroll reset path still keeps fit mode deterministic.
The ruler changes also look reasonable. Tick spacing now keys off pixels-per-second when available, falls back to duration-based spacing otherwise, and keeps a safety cap to avoid runaway DOM generation. The added tests cover the important zoom-density and subsecond label behavior.
I did not find any blocking issues in this patch.
Problem
The Studio timeline still only supported button-based zoom, and the ruler stayed too sparse at high zoom levels. Trackpad pinch gestures could also leak into browser/page zoom on macOS.
What this fixes
Root cause
Timeline zoom state was only changed by the Fit / plus / minus controls. The ruler tick generator only considered total duration, so the same labels were used regardless of the visible scale. React wheel handling was also too late/passive for preventing browser zoom reliably on macOS pinch events.
Verification
Local
bun run --filter @hyperframes/studio test src/player/components/Timeline.test.ts src/player/components/timelineZoom.test.tsbunx oxlint packages/studio/src/player/components/Timeline.tsx packages/studio/src/player/components/Timeline.test.ts packages/studio/src/player/components/timelineZoom.ts packages/studio/src/player/components/timelineZoom.test.tsbunx oxfmt --check packages/studio/src/player/components/Timeline.tsx packages/studio/src/player/components/Timeline.test.ts packages/studio/src/player/components/timelineZoom.ts packages/studio/src/player/components/timelineZoom.test.tsbun run --filter @hyperframes/studio typecheckBrowser
hf-designer-talkin Studio athttp://localhost:5190/?project=hf-designer-talk&record=1#project/hf-designer-talk.defaultPrevented: true, keptvisualViewport.scaleat1, and changed timeline zoom from100%to232%.476%displayed denser labels (0:00,0:10,0:20,0:30, …) rather than only sparse 30-second marks./tmp/hf-timeline-proof/hf-designer-talk-ruler-zoom.pngNotes
Stacked on #540 so the GSAP clip stability fix can land independently from the timeline gesture/ruler UX work.