Skip to content

feat(studio): add timeline pinch zoom#541

Merged
miguel-heygen merged 3 commits intomainfrom
feat/studio-timeline-pinch-zoom
Apr 28, 2026
Merged

feat(studio): add timeline pinch zoom#541
miguel-heygen merged 3 commits intomainfrom
feat/studio-timeline-pinch-zoom

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

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

  • Adds trackpad pinch / Ctrl-wheel timeline zoom that preserves the time under the pointer.
  • Captures pinch wheel events with a non-passive native listener so browser zoom does not take over.
  • Adapts ruler major/minor tick spacing from the current pixels-per-second, so zoomed timelines show denser professional-editor-style timecode labels instead of sparse duration-only labels.

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.ts
  • bunx 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.ts
  • bunx 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.ts
  • bun run --filter @hyperframes/studio typecheck

Browser

  • Previewed hf-designer-talk in Studio at http://localhost:5190/?project=hf-designer-talk&record=1#project/hf-designer-talk.
  • Verified synthetic pinch wheel events on the timeline were defaultPrevented: true, kept visualViewport.scale at 1, and changed timeline zoom from 100% to 232%.
  • Verified the zoomed ruler at 476% displayed denser labels (0:00, 0:10, 0:20, 0:30, …) rather than only sparse 30-second marks.
  • Screenshot: /tmp/hf-timeline-proof/hf-designer-talk-ruler-zoom.png

Notes

Stacked on #540 so the GSAP clip stability fix can land independently from the timeline gesture/ruler UX work.

Copy link
Copy Markdown
Collaborator

@vanceingalls vanceingalls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Base automatically changed from fix/studio-gsap-clip-offset to main April 28, 2026 22:09
@miguel-heygen miguel-heygen merged commit fc3c601 into main Apr 28, 2026
24 checks passed
@miguel-heygen miguel-heygen deleted the feat/studio-timeline-pinch-zoom branch April 28, 2026 22:22
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.

2 participants