🎥 Make videos programmatically with React
Merge remote-tracking branch 'origin/main' into codex/shared-timeline-row-collapse
Jonny Burgeradbfddfefc78
diff --cc packages/studio/src/components/Timeline/Timeline.tsxindex cb22f38a26,a58736af65..69d2745116--- a/packages/studio/src/components/Timeline/Timeline.tsx+++ b/packages/studio/src/components/Timeline/Timeline.tsx@@@ -436,9 -442,20 +442,21 @@@ const TimelineInner: React.FC = () =>collapsed,sequences,canvasContent?.type === 'composition' ? canvasContent.compositionId : null,+ compactSeries,);const {fastRefreshes} = useContext(FastRefreshContext);+ const trackOverlapError = useMemo(+ () => getTimelineTrackOverlapError(timeline, durationInFrames),+ [timeline, durationInFrames],+ );+ useEffect(() => {+ if (trackOverlapError === null) {+ return;+ }++ addErrorToOverlay(trackOverlapError, null);+ return () => removeErrorFromOverlay(trackOverlapError);+ }, [trackOverlapError, fastRefreshes]);const pendingSelectionStart = useRef<{selection: PendingInsertedElementSelection;fastRefreshes: number;diff --cc packages/studio/src/components/Timeline/TimelineLayerChildren.tsxindex 058033d719,e83027df19..83e8dc4197--- a/packages/studio/src/components/Timeline/TimelineLayerChildren.tsx+++ b/packages/studio/src/components/Timeline/TimelineLayerChildren.tsx@@@ -116,65 -125,6 +116,63 @@@ export const useTimelineLayerChildrenreturn {keys, parents, ancestors};}, [compositionId, sequences, tracks]);+ const toggle = useCallback(+ (key: string) => {+ const affectedKeys = new Set([key]);+ if (compactSeries) {+ const rows = getTimelineDisplayRows(tracks);+ const index = rows.findIndex(+ (row) => hierarchy.keys.get(row.track.sequence.id) === key,+ );+ // Find corresponding layers on click, before hiding any children.+ const layout = getTimelineSeriesLayout({+ rows,+ heights: rows.map(() => 1),+ sequences,+ compactSeries,+ paddingStart: 0,+ });- const position = layout.sharedChildPositions[index];- if (position) {++ if (index !== -1 && layout.sceneRanges[index] !== null) {+ for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {- const candidate = layout.sharedChildPositions[rowIndex];+ if (- candidate?.seriesIndex !== position.seriesIndex ||- candidate.role !== position.role ||- candidate.offset !== position.offset++ layout.sceneRanges[rowIndex] === null ||++ layout.groupIndexes[rowIndex] !== layout.groupIndexes[index] ||++ layout.offsets[rowIndex] !== layout.offsets[index]+ ) {+ continue;+ }++ const candidateKey = hierarchy.keys.get(+ rows[rowIndex].track.sequence.id,+ );+ if (candidateKey !== undefined) {+ affectedKeys.add(candidateKey);+ }+ }+ }+ }++ setCollapsed((previous) => {+ const next = {...previous};+ for (const affectedKey of affectedKeys) {+ if (previous[key]) {+ delete next[affectedKey];+ } else {+ next[affectedKey] = true;+ }+ }++ try {+ window.localStorage.setItem(STORAGE_KEY, JSON.stringify(next));+ } catch {+ // Keep the control usable when storage is unavailable.+ }++ return next;+ });+ },+ [compactSeries, hierarchy, sequences, tracks],+ );const visibleTracks = useMemo(() =>tracks.filter((track) => {