@@ -83,35 +83,36 @@ export function Timeline() {
8383 zoomSegmentDragState . type !== "moving" &&
8484 sceneSegmentDragState . type !== "moving"
8585 ) {
86- // Guard against missing bounds and clamp computed time to [0, totalDuration()]
87- if ( left == null ) return ;
88- const rawTime =
89- secsPerPixel ( ) * ( e . clientX - left ) + transform ( ) . position ;
90- const newTime = Math . min ( Math . max ( 0 , rawTime ) , totalDuration ( ) ) ;
86+ // Guard against missing bounds and clamp computed time to [0, totalDuration()]
87+ if ( left == null ) return ;
88+ const rawTime =
89+ secsPerPixel ( ) * ( e . clientX - left ) + transform ( ) . position ;
90+ const newTime = Math . min ( Math . max ( 0 , rawTime ) , totalDuration ( ) ) ;
9191
92- // If playing, some backends require restart to seek reliably
93- if ( editorState . playing ) {
94- try {
95- await commands . stopPlayback ( ) ;
92+ // If playing, some backends require restart to seek reliably
93+ if ( editorState . playing ) {
94+ try {
95+ await commands . stopPlayback ( ) ;
9696
97- // Round to nearest frame to prevent off-by-one drift
98- const targetFrame = Math . round ( newTime * FPS ) ;
99- await commands . seekTo ( targetFrame ) ;
97+ // Round to nearest frame to prevent off-by-one drift
98+ const targetFrame = Math . round ( newTime * FPS ) ;
99+ await commands . seekTo ( targetFrame ) ;
100100
101- // If the user paused during these async ops, bail out without restarting
102- if ( ! editorState . playing ) {
103- setEditorState ( "playbackTime" , newTime ) ;
104- return ;
105- }
101+ // If the user paused during these async ops, bail out without restarting
102+ if ( ! editorState . playing ) {
103+ setEditorState ( "playbackTime" , newTime ) ;
104+ return ;
105+ }
106106
107- await commands . startPlayback ( FPS , OUTPUT_SIZE ) ;
108- setEditorState ( "playing" , true ) ;
109- } catch ( err ) {
110- console . error ( "Failed to seek during playback:" , err ) ;
111- }
112- }
107+ await commands . startPlayback ( FPS , OUTPUT_SIZE ) ;
108+ setEditorState ( "playing" , true ) ;
109+ } catch ( err ) {
110+ console . error ( "Failed to seek during playback:" , err ) ;
111+ }
112+ }
113113
114- setEditorState ( "playbackTime" , newTime ) ;
114+ setEditorState ( "playbackTime" , newTime ) ;
115+ }
115116 }
116117
117118 createEventListener ( window , "keydown" , ( e ) => {
0 commit comments