Repository navigation
feat(editor): timeline auto-pages to keep playhead on screen - #6
#6Merged
Merged
Conversation
…layback When zoomed in, the playhead used to run off the visible region and the user lost sight of where playback was. The timeline now snaps scrollX so the playhead reappears at the left edge of the next "screen" the moment it exits the visible range. Instant (no animation), since at high zoom the page-flip fires often. Gated on the playhead having actually moved this render — manual scrolling while paused is preserved instead of snapping back to the playhead. During playback, scrolling away will be re-paged on the next frame (matches standard NLE follow-playhead behavior). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the timeline is zoomed in and playback advances past the right edge of the visible region, the playhead currently disappears off-screen until the user manually scrolls. This change makes the timeline page instead —
scrollXsnaps so the playhead reappears at the left edge of the next "screen" the moment it exits the visible range.useEffectinTimeline.tsxwatchingcurrentTimeagainst the existingviewStart/viewEndderived in renderuseRef, so manual scrolling while paused is preserved rather than snapping back to the playheadscrollX/zoomstate)Why
Watching playback at zoom ≥ 4 was unusable: the playhead would slide off the right edge within a few seconds and the user had to hand-scroll just to see where they were. Standard NLE behavior is "follow playhead during playback, paging at the boundary"; this brings the editor in line with that.
Notes for reviewers
movedref is what keeps paused-state manual scrolls from being undone. Without it, the effect would fire when only the view changed (user scroll) and snap back to the stationary playhead.isPlayinggate — themovedref subsumes its job and lets manual seeks page correctly.Test plan
zoom ≈ 8), press play → playhead reaches right edge → timeline snaps so playhead is at the left of the next page; repeats every few secondsplayback.loopand let it wrap → view pages backward to follow the wrapmaxScroll); playhead glides to the right edge instead of paging past the end🤖 Generated with Claude Code