Skip to content

🎥 Make videos programmatically with React

@remotion/studio: Exclude hidden timeline elements from canvas selection (#8282)

Jonny Burger8665dbbb28c1
diff --git a/packages/studio/src/components/SelectedOutlineOverlay.tsx b/packages/studio/src/components/SelectedOutlineOverlay.tsx
index 8ddbea84af..15ae00a80a 100644
--- a/packages/studio/src/components/SelectedOutlineOverlay.tsx
+++ b/packages/studio/src/components/SelectedOutlineOverlay.tsx
@@ -512,7 +512,10 @@ export const getSequencesWithSelectableOutlines = ({
return false;
}
- return track.nodePathInfo.auxiliaryKeys.length === 0;
+ return (
+ track.sequence.showInTimeline &&
+ track.nodePathInfo.auxiliaryKeys.length === 0
+ );
})
.filter((track) => track.sequence.refForOutline !== null)
.sort((a, b) => a.depth - b.depth)
diff --git a/packages/studio/src/test/timeline-selection.test.ts b/packages/studio/src/test/timeline-selection.test.ts
index 7236449224..04e59d2bfa 100644
--- a/packages/studio/src/test/timeline-selection.test.ts
+++ b/packages/studio/src/test/timeline-selection.test.ts
@@ -146,6 +146,7 @@ const makeTimelineSequence = ({
duration = 100,
from = 0,
type = 'sequence',
+ showInTimeline = true,
}: {
readonly schema: SequenceSchema;
readonly effects?: readonly {readonly schema: SequenceSchema}[];
@@ -156,6 +157,7 @@ const makeTimelineSequence = ({
readonly duration?: number;
readonly from?: number;
readonly type?: TSequence['type'];
+ readonly showInTimeline?: boolean;
}): TSequence =>
({
type,
@@ -166,7 +168,7 @@ const makeTimelineSequence = ({
documentationLink: null,
parent: parentId,
rootId: 'root',
- showInTimeline: true,
+ showInTimeline,
nonce: [[0, 0]],
loopDisplay: undefined,
getStack: () => null,
@@ -1241,6 +1243,50 @@ test('Canvas outline hit targets render nested sequences above parents', () => {
]);
});
+test('Canvas outline hit targets exclude sequences hidden from the timeline', () => {
+ const schema = {} satisfies SequenceSchema;
+ const refForOutline = {current: null};
+ const hiddenNodePathInfo = makeNodePathInfo(['body', 0], []);
+ const visibleNodePathInfo = makeNodePathInfo(['body', 1], []);
+ const childNodePathInfo = makeNodePathInfo(['body', 0, 'children', 0], []);
+ const outlines = getSequencesWithSelectableOutlines({
+ sequences: [
+ makeTimelineSequence({
+ schema,
+ id: 'hidden',
+ overrideId: 'hidden',
+ refForOutline,
+ showInTimeline: false,
+ }),
+ makeTimelineSequence({
+ schema,
+ id: 'visible',
+ overrideId: 'visible',
+ refForOutline,
+ }),
+ makeTimelineSequence({
+ schema,
+ id: 'child',
+ overrideId: 'child',
+ parentId: 'hidden',
+ refForOutline,
+ }),
+ ],
+ overrideIdsToNodePaths: {
+ hidden: hiddenNodePathInfo.sequenceSubscriptionKey,
+ visible: visibleNodePathInfo.sequenceSubscriptionKey,
+ child: childNodePathInfo.sequenceSubscriptionKey,
+ },
+ });
+
+ expect(outlines.map((outline) => outline.key).sort()).toEqual(
+ [
+ getTimelineSequenceSelectionKey(visibleNodePathInfo),
+ getTimelineSequenceSelectionKey(childNodePathInfo),
+ ].sort(),
+ );
+});
+
test('UV handles project semantic outline corners', () => {
const points = [
{x: 200, y: 200},