Improve timeline navigation while scrubbing and scrolling#243
Conversation
📝 WalkthroughWalkthroughThis PR enhances the timeline editor component with pan-on-wheel and pan-on-drag functionality. It adds helper functions for range clamping and wheel delta normalization, extends Changes
Sequence DiagramssequenceDiagram
actor User
participant PlaybackCursor
participant TimelineEditor
User->>PlaybackCursor: Drag cursor beyond bounds
PlaybackCursor->>PlaybackCursor: Update dragPreviewTimeMs
PlaybackCursor->>TimelineEditor: onRangeChange(updater)
TimelineEditor->>TimelineEditor: setRange(clampVisibleRange(updater))
TimelineEditor->>PlaybackCursor: Re-render with new range
PlaybackCursor->>User: Display updated preview time
sequenceDiagram
actor User
participant Timeline
participant TimelineEditor
User->>Timeline: Scroll wheel (without Ctrl/Meta)
Timeline->>Timeline: normalizeWheelDelta(wheelEvent)
Timeline->>Timeline: Detect dominant axis
Timeline->>Timeline: Calculate timeShift
Timeline->>TimelineEditor: onRangeChange(updater)
TimelineEditor->>TimelineEditor: setRange(clampVisibleRange(updater))
TimelineEditor->>Timeline: Re-render with panned range
Timeline->>User: Display shifted timeline
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly Related Issues
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 203282be43
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/components/video-editor/timeline/TimelineEditor.tsx`:
- Around line 279-314: The current pan logic only reacts to incoming mousemove
events and stops when the pointer is held at the edge; instead implement an
animation-driven pan loop: create a small edge threshold (e.g.
EDGE_THRESHOLD_PX) and store the latest pointer X (clickX / pointerX) during
pointermove/drag start, then start a requestAnimationFrame loop on drag start
that computes visibleMs, msPerPixel, overflow (using threshold) from that stored
pointer X and calls onRangeChange with a clamped shift (using clampVisibleRange)
each frame until the pointer moves back inside threshold or the visible range
hits 0/videoDurationMs; stop the RAF on drag end/cancel. Use the existing
symbols visibleMs, contentWidth, videoDurationMs, clampVisibleRange and
onRangeChange so the core shift logic remains the same but driven by RAF and the
stored pointer position.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f8b74f8e-2bc3-4de4-b79d-c648afb219a9
📒 Files selected for processing (1)
src/components/video-editor/timeline/TimelineEditor.tsx
Description
Improve timeline navigation in the editor by adding:
Motivation
Editing longer recordings was awkward because the visible timeline range could not be moved naturally during common interactions. Dragging the playhead to either edge stopped at the current viewport, and row scrolling did not let users inspect nearby time ranges while keeping the playhead fixed.
Type of Change
Related Issue(s)
#242
Screenshots / Video
Video (if applicable):
Screen.Recording.2026-03-20.at.4.53.42.PM.mov
Testing
Commands used:
npm exec tsc --noEmit ./node_modules/.bin/biome check src/components/video-editor/timeline/TimelineEditor.tsxChecklist
Thank you for contributing!
Summary by CodeRabbit