@@ -166,21 +166,17 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(
166166 const newSegmentStart = segment . end ;
167167 const newSegmentEnd = newSegmentStart + segmentDuration ;
168168
169- // Check if there's enough space in the timeline
170169 const timelineDuration = totalDuration ( ) ;
171170 if ( newSegmentEnd > timelineDuration ) {
172- // Not enough space for the duplicate
173171 return ;
174172 }
175173
176- // Check if the new segment would overlap with any existing scene segments
177174 const wouldOverlap = project . timeline . sceneSegments . some ( ( s , i ) => {
178175 if ( i === segmentIndex ) return false ; // Skip the original segment
179176 return newSegmentStart < s . end && newSegmentEnd > s . start ;
180177 } ) ;
181178
182179 if ( wouldOverlap ) {
183- // Would overlap with another segment
184180 return ;
185181 }
186182
@@ -190,26 +186,21 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(
190186 "sceneSegments" ,
191187 produce ( ( s ) => {
192188 if ( ! s ) return ;
193- // Insert duplicate right after the original
194189 s . splice ( segmentIndex + 1 , 0 , {
195190 ...segment ,
196191 start : newSegmentStart ,
197192 end : newSegmentEnd ,
198- // Deep clone split view settings if present
199193 splitViewSettings : segment . splitViewSettings
200194 ? { ...segment . splitViewSettings }
201195 : undefined ,
202196 } ) ;
203197 } ) ,
204198 ) ;
205- // Select and click on the newly duplicated segment
206199 setEditorState ( "timeline" , "selection" , {
207200 type : "scene" ,
208201 index : segmentIndex + 1 ,
209202 } ) ;
210- // Move playhead to the start of the new segment
211203 setEditorState ( "playbackTime" , newSegmentStart ) ;
212- // Center the timeline view on the new segment
213204 const currentZoom = editorState . timeline . transform . zoom ;
214205 const targetPosition = Math . max ( 0 , newSegmentStart - currentZoom / 2 ) ;
215206 editorState . timeline . transform . setPosition ( targetPosition ) ;
@@ -218,7 +209,6 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(
218209 copySceneSettingsFromOriginal : ( segmentIndex : number ) => {
219210 if ( ! project . timeline ?. sceneSegments ?. [ segmentIndex ] ) return ;
220211
221- // Find the first segment with the same mode
222212 const currentSegment = project . timeline . sceneSegments [ segmentIndex ] ;
223213 const originalSegment = project . timeline . sceneSegments . find (
224214 ( s , i ) => i !== segmentIndex && s . mode === currentSegment . mode ,
@@ -232,11 +222,9 @@ export const [EditorContextProvider, useEditorContext] = createContextProvider(
232222 segmentIndex ,
233223 produce ( ( s ) => {
234224 if ( ! s ) return ;
235- // Copy settings based on mode
236225 if ( s . mode === "splitView" && originalSegment . splitViewSettings ) {
237226 s . splitViewSettings = { ...originalSegment . splitViewSettings } ;
238227 }
239- // Can add more mode-specific settings copying here in the future
240228 } ) ,
241229 ) ;
242230 } ,
@@ -419,7 +407,7 @@ function transformMeta({ pretty_name, ...rawMeta }: RecordingMeta) {
419407 throw new Error ( "Instant mode recordings cannot be edited" ) ;
420408 }
421409
422- let meta ;
410+ let meta = null ;
423411
424412 if ( "segments" in rawMeta ) {
425413 meta = {
0 commit comments