🎥 Make videos programmatically with React
`@remotion/studio`: Show trimmed layer extent during timeline drag
JonnyBurger466e37c44ae9
diff --git a/packages/studio/src/components/Timeline/TimelineSequenceRightEdgeDragHandle.tsx b/packages/studio/src/components/Timeline/TimelineSequenceRightEdgeDragHandle.tsxindex 83a844b1f0..340fff867b 100644--- a/packages/studio/src/components/Timeline/TimelineSequenceRightEdgeDragHandle.tsx+++ b/packages/studio/src/components/Timeline/TimelineSequenceRightEdgeDragHandle.tsx@@ -1204,10 +1204,11 @@ export const getTimelineSequenceLeftEdgeDragTargets = ({const key = stringifySequenceSubscriptionKey(nodePath);if (!targets.has(key)) {const runtimeValues = controls.runtimeValues.getSnapshot();- const trimBeforeStatus = Internals.getPropStatusesCtx(+ const sequencePropStatuses = Internals.getPropStatusesCtx(propStatuses,nodePath,- )?.trimBefore;+ );+ const trimBeforeStatus = sequencePropStatuses?.trimBefore;const ownTrimBefore =trimBeforeStatus?.status === 'static' &&typeof trimBeforeStatus.codeValue === 'number'@@ -1219,7 +1220,12 @@ export const getTimelineSequenceLeftEdgeDragTargets = ({sequence: originalSequence,runtimeValues,});- const runtimeDuration = runtimeValues.durationInFrames;+ const durationStatus = sequencePropStatuses?.durationInFrames;+ const runtimeDuration =+ durationStatus?.status === 'static' &&+ typeof durationStatus.codeValue === 'number'+ ? durationStatus.codeValue+ : runtimeValues.durationInFrames;targets.set(key, {parentPlaybackRate: getParentSequencePlaybackRate(originalSequence,diff --git a/packages/studio/src/test/timeline-selection.test.ts b/packages/studio/src/test/timeline-selection.test.tsindex fa05e047a6..5d50147e45 100644--- a/packages/studio/src/test/timeline-selection.test.ts+++ b/packages/studio/src/test/timeline-selection.test.ts@@ -340,9 +340,10 @@ const makeLeftEdgePropStatuses = (nodePaths: readonly SequencePropsSubscriptionKey[],includeTrimBefore = false,includeTimelineRange = true,+ durationInFramesCodeValues: readonly (number | undefined)[] | null = null,): PropStatuses => {const propStatuses: PropStatuses = {};- for (const nodePath of nodePaths) {+ for (const [index, nodePath] of nodePaths.entries()) {propStatuses[Internals.makeSequencePropsSubscriptionKey(nodePath)] = {canUpdate: true,props: {@@ -351,7 +352,7 @@ const makeLeftEdgePropStatuses = (durationInFrames: {status: 'static' as const,keyframeDisplayOffsetAdjustment: null,- codeValue: 100,+ codeValue: durationInFramesCodeValues?.[index],},from: {status: 'static' as const,@@ -2053,7 +2054,7 @@ test('Timeline edge drags edit durationInFrames in the child clock', () => {).toMatchObject({fieldKey: 'durationInFrames', value: 24});});-test('Left edge trim updates durationInFrames in the child clock', () => {+test('Left edge trim preserves a recent right edge trim in the child clock', () => {const nodePathInfo = makeNodePathInfo(['body', 0], []);const nodePath = nodePathInfo.sequenceSubscriptionKey;const sequence = makeTimelineSequence({@@ -2072,7 +2073,7 @@ test('Left edge trim updates durationInFrames in the child clock', () => {selectedItems: [{type: 'sequence', nodePathInfo}],sequences: [sequence],overrideIdsToNodePaths: {override: nodePath},- propStatuses: makeLeftEdgePropStatuses([nodePath], true),+ propStatuses: makeLeftEdgePropStatuses([nodePath], true, true, [16]),});expect(@@ -2082,7 +2083,7 @@ test('Left edge trim updates durationInFrames in the child clock', () => {}).map((change) => [change.fieldKey, change.value]),).toEqual([['from', 2],- ['durationInFrames', 16],+ ['durationInFrames', 12],['trimBefore', 8],]);});