Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 29 additions & 2 deletions packages/studio/src/components/InspectorSequenceSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import {ModalsContext} from '../state/modals';
import {InlineAction} from './InlineAction';
import {sectionHeaderRow, sectionHeaderTitle} from './InspectorPanel/styles';
import {TimelineExpandedRow} from './Timeline/TimelineExpandedRow';
import {
getTimelineSelectionFromNodePathInfo,
TimelineSelectionOrderProvider,
type TimelineSelection,
} from './Timeline/TimelineSelection';
import {useTimelineExpandedTree} from './Timeline/use-timeline-expanded-tree';

const container: React.CSSProperties = {
Expand Down Expand Up @@ -73,6 +78,15 @@ type SequenceWithControls = TSequence & {
readonly controls: NonNullable<TSequence['controls']>;
};

export const getInspectorSelectableItems = (
rows: readonly FlatTreeRow[],
): TimelineSelection[] => {
return rows.flatMap(({node}): TimelineSelection[] => {
const selection = getTimelineSelectionFromNodePathInfo(node.nodePathInfo);
return selection ? [selection] : [];
});
};

export const hasSequenceControls = (
sequence: TSequence,
): sequence is SequenceWithControls => {
Expand Down Expand Up @@ -150,6 +164,15 @@ export const InspectorSequenceSection: React.FC<{
};
}, [getIsExpanded, tree]);

const controlSelectableItems = useMemo(
() => getInspectorSelectableItems(controlRows),
[controlRows],
);
const effectSelectableItems = useMemo(
() => getInspectorSelectableItems(effectRows),
[effectRows],
);

const {schema} = sequence.controls;
const showEffectsSection =
nodePathInfo.supportsEffects || effectRows.length > 0;
Expand Down Expand Up @@ -225,7 +248,9 @@ export const InspectorSequenceSection: React.FC<{
<div style={container}>
<div style={divider} />
{controlRows.length > 0 ? renderSectionHeader('Controls') : null}
{controlRows.map(renderRow)}
<TimelineSelectionOrderProvider items={controlSelectableItems}>
{controlRows.map(renderRow)}
</TimelineSelectionOrderProvider>
{showEffectsSection ? (
<>
{showControlsEffectsDivider ? (
Expand All @@ -235,7 +260,9 @@ export const InspectorSequenceSection: React.FC<{
{effectRows.length === 0 ? (
<div style={emptyState}>None</div>
) : (
effectRows.map(renderRow)
<TimelineSelectionOrderProvider items={effectSelectableItems}>
{effectRows.map(renderRow)}
</TimelineSelectionOrderProvider>
)}
</>
) : null}
Expand Down
80 changes: 44 additions & 36 deletions packages/studio/src/components/Timeline/Timeline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ import {TimelineList} from './TimelineList';
import {TimelinePinchZoom} from './TimelinePinchZoom';
import {TimelinePlayCursorSyncer} from './TimelinePlayCursorSyncer';
import {TimelineScrollable} from './TimelineScrollable';
import {TimelineSelectAllKeybindings} from './TimelineSelection';
import {
TimelineSelectableItemsProvider,
TimelineSelectAllKeybindings,
} from './TimelineSelection';
import {TimelineSlider} from './TimelineSlider';
import {
TimelineTimeIndicators,
Expand Down Expand Up @@ -266,42 +269,47 @@ const TimelineInner: React.FC = () => {
})}
<SequencePropsObserver />
<TimelineKeyframeTracksProvider tracks={filtered}>
<TimelineSelectAllKeybindings timeline={shown} />
<TimelineHeightContainer shown={shown} hasBeenCut={hasBeenCut}>
{isStill ? (
<TimelineList timeline={shown} />
) : (
<TimelineWidthProvider>
<TimelinePinchZoom />
<SplitterContainer
orientation="vertical"
defaultFlex={0.2}
id="names-to-timeline"
maxFlex={0.5}
minFlex={0.15}
>
<SplitterElement
type="flexer"
sticky={<TimelineTimePlaceholders />}
<TimelineSelectableItemsProvider timeline={shown}>
<TimelineSelectAllKeybindings timeline={shown} />
<TimelineHeightContainer shown={shown} hasBeenCut={hasBeenCut}>
{isStill ? (
<TimelineList timeline={shown} />
) : (
<TimelineWidthProvider>
<TimelinePinchZoom />
<SplitterContainer
orientation="vertical"
defaultFlex={0.2}
id="names-to-timeline"
maxFlex={0.5}
minFlex={0.15}
>
<TimelineList timeline={shown} />
</SplitterElement>
<SplitterHandle onCollapse={noop} allowToCollapse="none" />
<SplitterElement type="anti-flexer" sticky={null}>
<TimelineScrollable>
<TimelineTracks timeline={shown} hasBeenCut={hasBeenCut} />
<TimelinePlayCursorSyncer />
<TimelineInOutPointer />
<TimelineTimeIndicators />
<TimelineDragHandler />
<TimelineInOutDragHandler />
<TimelineSlider />
</TimelineScrollable>
</SplitterElement>
</SplitterContainer>
</TimelineWidthProvider>
)}
</TimelineHeightContainer>
<SplitterElement
type="flexer"
sticky={<TimelineTimePlaceholders />}
>
<TimelineList timeline={shown} />
</SplitterElement>
<SplitterHandle onCollapse={noop} allowToCollapse="none" />
<SplitterElement type="anti-flexer" sticky={null}>
<TimelineScrollable>
<TimelineTracks
timeline={shown}
hasBeenCut={hasBeenCut}
/>
<TimelinePlayCursorSyncer />
<TimelineInOutPointer />
<TimelineTimeIndicators />
<TimelineDragHandler />
<TimelineInOutDragHandler />
<TimelineSlider />
</TimelineScrollable>
</SplitterElement>
</SplitterContainer>
</TimelineWidthProvider>
)}
</TimelineHeightContainer>
</TimelineSelectableItemsProvider>
</TimelineKeyframeTracksProvider>
</TimelineContextMenuArea>
);
Expand Down
Loading
Loading