Skip to content

🎥 Make videos programmatically with React

@remotion/canvas: Select scenes inside full-frame series

Jonny Burgeraabf62061cc9
diff --git a/packages/canvas/src/outline-order.ts b/packages/canvas/src/outline-order.ts
index f5733e6f84..a781f7db9c 100644
--- a/packages/canvas/src/outline-order.ts
+++ b/packages/canvas/src/outline-order.ts
@@ -1,7 +1,9 @@
import type {CanvasOutline} from './outline-geometry';
export type CanvasOutlineOrderTarget = {
- readonly sequence: CanvasOutlineSequenceParent;
+ readonly sequence: CanvasOutlineSequenceParent & {
+ readonly controls?: {readonly componentIdentity: string | null} | null;
+ };
readonly selected: boolean;
readonly containsSelection: boolean;
};
@@ -219,21 +221,25 @@ const orderOutlineGroup = ({
const addAncestorConstraint = ({
ancestor,
+ ancestorIsSeries,
descendant,
descendantContainsSelection,
equivalentHitArea,
}: {
readonly ancestor: CanvasOutline;
+ readonly ancestorIsSeries: boolean;
readonly descendant: CanvasOutline;
readonly descendantContainsSelection: boolean;
readonly equivalentHitArea: boolean;
}) => {
- // Usually, children should be above parents so nested elements are directly
- // selectable. If an unselected child has the same hit area as its parent, put
- // it below the parent so the wrapper can be selected. Once the child or
- // one of its properties is selected, keep it above the parent so it remains
- // directly draggable.
- if (equivalentHitArea && !descendantContainsSelection) {
+ // Equal-sized children normally sit below their parent so the wrapper can
+ // be selected. Series and TransitionSeries only arrange their children, so
+ // their active scene should receive a canvas click instead.
+ if (
+ equivalentHitArea &&
+ !descendantContainsSelection &&
+ !ancestorIsSeries
+ ) {
addEdge(descendant, ancestor, null);
} else {
addEdge(ancestor, descendant, null);
@@ -258,8 +264,14 @@ const orderOutlineGroup = ({
while (parentId !== null) {
const ancestor = outlineBySequenceId.get(parentId);
if (ancestor !== undefined) {
+ const ancestorComponentIdentity = targetsByKey.get(ancestor.key)
+ ?.sequence.controls?.componentIdentity;
addAncestorConstraint({
ancestor,
+ ancestorIsSeries:
+ ancestorComponentIdentity === 'dev.remotion.remotion.Series' ||
+ ancestorComponentIdentity ===
+ 'dev.remotion.transitions.TransitionSeries',
descendant,
descendantContainsSelection:
(descendantTarget?.selected ?? false) ||
diff --git a/packages/skills/skills/remotion-interactivity/SKILL.md b/packages/skills/skills/remotion-interactivity/SKILL.md
index cbf5c7318e..2964c0f7e4 100644
--- a/packages/skills/skills/remotion-interactivity/SKILL.md
+++ b/packages/skills/skills/remotion-interactivity/SKILL.md
@@ -201,12 +201,9 @@ handle timing. Keep `<Series.Sequence>` for consecutive layout and
`<TransitionSeries.Sequence>` for transitions; direct `from` props do not
replace those behaviors.
-When an outer `<TransitionSeries>` only organizes full-frame scenes, set
-`showInTimeline={false}` on that parent. Studio puts a full-frame parent outline
-above an unselected child with the same hit area, so clicking the canvas would
-otherwise select the container instead of the active scene sequence. Hiding
-the parent row removes its canvas outline while keeping child sequences
-visible and selectable in the timeline.
+Studio prioritizes the active child scene over an equal-sized outer `<Series>`
+or `<TransitionSeries>` when clicking the canvas. Keep the outer series visible
+in the timeline so it can still be selected there when needed.
## Give every independently editable item its own JSX node
diff --git a/packages/skills/skills/remotion-markup/SKILL.md b/packages/skills/skills/remotion-markup/SKILL.md
index a331185fa1..4b980ade5d 100644
--- a/packages/skills/skills/remotion-markup/SKILL.md
+++ b/packages/skills/skills/remotion-markup/SKILL.md
@@ -24,10 +24,6 @@ Use `Easing.bezier()` and `Easing.spring()` to customize timing.
Structure your markup according to [Remotion Interactivity Best Practices](../remotion-interactivity/SKILL.md).
Prefer `Interactive.withSchema({wrapInSequence: true})` for custom visual components
with editable props, and register reusable scenes as connected compositions.
-For a multi-scene video, set `showInTimeline={false}` on the structural
-`<TransitionSeries>` parent when its child sequences should be selected by
-clicking the canvas. The child sequences remain visible and selectable in the
-timeline. See [Multi-scene videos](multi-scene-video.md).
Put timing directly on components that support it; avoid redundant `<Sequence>` wrappers.
Give every timed component that supports `premountFor` one second of premounting:
`premountFor={fps}`, where `fps` comes from `useVideoConfig()`. Apply this to
diff --git a/packages/skills/skills/remotion-markup/multi-scene-video.md b/packages/skills/skills/remotion-markup/multi-scene-video.md
index b6df1f90d5..7b0041c419 100644
--- a/packages/skills/skills/remotion-markup/multi-scene-video.md
+++ b/packages/skills/skills/remotion-markup/multi-scene-video.md
@@ -13,11 +13,8 @@ intentionally controlled as one source template.
Use `<TransitionSeries>` when the scenes may have transitions.
Install `@remotion/transitions` if it is missing.
Give each sequence an inline `durationInFrames` value so Studio can edit its timing.
-Set `showInTimeline={false}` on the outer `<TransitionSeries>` when it is only
-a structural container. Otherwise its full-frame canvas outline competes with
-the active scene's full-frame outline and may receive clicks. This hides only
-the container row; the scene sequences remain in the timeline and selectable
-on the canvas.
+Keep the outer `<TransitionSeries>` visible in the timeline. Studio favors its
+active scene sequence when both have the same full-frame canvas outline.
Example:
@@ -32,7 +29,7 @@ export const MyVideo = () => {
const {fps} = useVideoConfig();
return (
- <TransitionSeries showInTimeline={false}>
+ <TransitionSeries>
<TransitionSeries.Sequence
name="Opening"
durationInFrames={90}
diff --git a/packages/skills/skills/remotion-markup/sequencing.md b/packages/skills/skills/remotion-markup/sequencing.md
index 3b4551ff55..a39c5c730c 100644
--- a/packages/skills/skills/remotion-markup/sequencing.md
+++ b/packages/skills/skills/remotion-markup/sequencing.md
@@ -78,7 +78,7 @@ Use `<TransitionSeries>` for consecutive scenes that may need transitions. Witho
```tsx
import { TransitionSeries } from "@remotion/transitions";
-<TransitionSeries showInTimeline={false}>
+<TransitionSeries>
<TransitionSeries.Sequence durationInFrames={45} premountFor={fps}>
<Intro />
</TransitionSeries.Sequence>
diff --git a/packages/skills/skills/remotion-markup/transitions.md b/packages/skills/skills/remotion-markup/transitions.md
index f240423f89..0e33e59541 100644
--- a/packages/skills/skills/remotion-markup/transitions.md
+++ b/packages/skills/skills/remotion-markup/transitions.md
@@ -17,9 +17,9 @@ Set `premountFor={fps}` on every `<TransitionSeries.Sequence>` and
timed children inside those items as well. `<TransitionSeries.Transition>`
does not accept `premountFor`.
-For a multi-scene timeline, set `showInTimeline={false}` on the outer
-`<TransitionSeries>` so clicking a full-frame scene selects its sequence
-instead of the full-frame container. The child sequence rows stay visible.
+For a multi-scene timeline, keep the outer `<TransitionSeries>` visible in the
+timeline. Studio favors the active scene sequence when the two have the same
+full-frame canvas outline.
Children are absolutely positioned.
@@ -35,7 +35,7 @@ npx remotion add @remotion/transitions
import { TransitionSeries, linearTiming } from "@remotion/transitions";
import { fade } from "@remotion/transitions/fade";
-<TransitionSeries showInTimeline={false}>
+<TransitionSeries>
<TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>
<SceneA />
</TransitionSeries.Sequence>
@@ -79,7 +79,7 @@ const LightLeakOverlay: React.FC = () => {
);
};
-<TransitionSeries showInTimeline={false}>
+<TransitionSeries>
<TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>
<SceneA />
</TransitionSeries.Sequence>
@@ -123,7 +123,7 @@ const LightLeakOverlay: React.FC = () => {
);
};
-<TransitionSeries showInTimeline={false}>
+<TransitionSeries>
<TransitionSeries.Sequence durationInFrames={60} premountFor={fps}>
<SceneA />
</TransitionSeries.Sequence>
diff --git a/packages/skills/skills/remotion-markup/video-editing.md b/packages/skills/skills/remotion-markup/video-editing.md
index d43ed62cde..d854415944 100644
--- a/packages/skills/skills/remotion-markup/video-editing.md
+++ b/packages/skills/skills/remotion-markup/video-editing.md
@@ -114,7 +114,7 @@ Use `<TransitionSeries>` when the timeline needs transitions or overlays.
Preserve the same one-source-node-per-clip structure:
```tsx
-<TransitionSeries name="Video timeline" showInTimeline={false}>
+<TransitionSeries name="Video timeline">
<TransitionSeries.Sequence name="Opening" durationInFrames={78} premountFor={fps}>
<Video
src="https://remotion.media/video.mp4"