🎥 Make videos programmatically with React
fix(studio): keep negative sequence frame info visible
YUHAO-cornaa0d942fe04f
diff --git a/packages/example/e2e/studio.test.mts b/packages/example/e2e/studio.test.mtsindex 509d340418..964ce8c89d 100644--- a/packages/example/e2e/studio.test.mts+++ b/packages/example/e2e/studio.test.mts@@ -425,21 +425,63 @@ test.describe('visual mode', () => {);await expect(negativeSequence).toBeVisible();await expect(zeroSequence).toBeVisible();-- const [timelineRect, negativeSequenceRect, zeroSequenceRect] =- await Promise.all([- timelineScrollable.boundingBox(),- negativeSequence.boundingBox(),- zeroSequence.boundingBox(),- ]);+ const negativeSequenceFrame = negativeSequence.locator(+ '[data-timeline-sequence-frame]',+ );+ await expect(negativeSequenceFrame).toContainText('20');++ const [+ timelineRect,+ negativeSequenceRect,+ negativeSequenceFrameRect,+ zeroSequenceRect,+ ] = await Promise.all([+ timelineScrollable.boundingBox(),+ negativeSequence.boundingBox(),+ negativeSequenceFrame.boundingBox(),+ zeroSequence.boundingBox(),+ ]);expect(timelineRect).not.toBeNull();expect(negativeSequenceRect).not.toBeNull();+ expect(negativeSequenceFrameRect).not.toBeNull();expect(zeroSequenceRect).not.toBeNull();expect(negativeSequenceRect!.x).toBeGreaterThanOrEqual(timelineRect!.x);expect(negativeSequenceRect!.x).toBeLessThan(zeroSequenceRect!.x);expect(zeroSequenceRect!.x - negativeSequenceRect!.x).toBeLessThanOrEqual(16,);+ expect(+ negativeSequenceFrameRect!.x + negativeSequenceFrameRect!.width,+ ).toBeGreaterThan(negativeSequenceRect!.x + negativeSequenceRect!.width);+ expect(+ await negativeSequence.evaluate(+ (element) => getComputedStyle(element).overflow,+ ),+ ).toBe('visible');+ expect(+ await negativeSequence.evaluate((element) => {+ const frame = element.querySelector('[data-timeline-sequence-frame]');+ if (!frame) {+ return true;+ }++ const frameRight = frame.getBoundingClientRect().right;+ let ancestor = frame.parentElement;+ while (ancestor && ancestor !== element) {+ const overflow = getComputedStyle(ancestor).overflow;+ if (+ (overflow === 'hidden' || overflow === 'clip') &&+ ancestor.getBoundingClientRect().right < frameRight+ ) {+ return true;+ }++ ancestor = ancestor.parentElement;+ }++ return false;+ }),+ ).toBe(false);});test('should commit a color drag before the picker closes', async ({diff --git a/packages/example/src/TimelineNegativeFromResize/index.tsx b/packages/example/src/TimelineNegativeFromResize/index.tsxindex 323ccbff67..2f088a7499 100644--- a/packages/example/src/TimelineNegativeFromResize/index.tsx+++ b/packages/example/src/TimelineNegativeFromResize/index.tsx@@ -5,10 +5,12 @@ import {AbsoluteFill, Sequence} from 'remotion';export const TimelineNegativeFromResize: React.FC = () => {return (<>- <AbsoluteFill style={{backgroundColor: '#202020'}} from={-1}>+ <AbsoluteFill style={{backgroundColor: '#202020'}}><Sequencename="Negative start"- durationInFrames={36}+ from={-20}+ durationInFrames={21}+ freeze={20}style={{backgroundColor: 'black'}}><Starburst rays={16} colors={['#ffdd00', '#ff8800']} />diff --git a/packages/studio/src/components/Timeline/TimelineSequence.tsx b/packages/studio/src/components/Timeline/TimelineSequence.tsxindex 875191cdf1..e2c8ffe6b4 100644--- a/packages/studio/src/components/Timeline/TimelineSequence.tsx+++ b/packages/studio/src/components/Timeline/TimelineSequence.tsx@@ -266,9 +266,33 @@ const TimelineSequenceCurrentFrame: React.FC<{...style,background: negativeStart ? TRANSPARENT : style.background,border: negativeStart ? 'none' : style.border,+ overflow: negativeStart ? 'visible' : style.overflow,opacity: hasSelectedTrack && !selected && !containsSelection ? 0.75 : 1,};}, [containsSelection, negativeStart, selected, selectedItems, style]);+ const showSequenceFrame =+ s.type !== 'audio' &&+ s.type !== 'video' &&+ s.type !== 'image' &&+ s.loopDisplay === undefined &&+ (isInRange || isPremounting || isPostmounting);+ const sequenceFrameInfo = showSequenceFrame ? (+ <div+ data-timeline-sequence-frame+ style={{+ height: '100%',+ display: 'flex',+ alignItems: 'center',+ }}+ >+ <TimelineSequenceFrame+ premounted={isPremounting}+ postmounted={isPostmounting ? s.duration - 1 : null}+ roundedFrame={roundedFrame}+ frozenFrame={frozenFrame}+ />+ </div>+ ) : null;const content = (<>@@ -310,26 +334,14 @@ const TimelineSequenceCurrentFrame: React.FC<{{children}- {s.type !== 'audio' &&- s.type !== 'video' &&- s.type !== 'image' &&- s.loopDisplay === undefined &&- (isInRange || isPremounting || isPostmounting) ? (+ {sequenceFrameInfo && !negativeStart ? (<divstyle={{- paddingLeft:- 5 + (negativeStart?.width ?? 0) + (premount?.width ?? 0),+ paddingLeft: 5 + (premount?.width ?? 0),height: '100%',- display: 'flex',- alignItems: 'center',}}>- <TimelineSequenceFrame- premounted={isPremounting}- postmounted={isPostmounting ? s.duration - 1 : null}- roundedFrame={roundedFrame}- frozenFrame={frozenFrame}- />+ {sequenceFrameInfo}</div>) : null}</>@@ -384,6 +396,19 @@ const TimelineSequenceCurrentFrame: React.FC<{{content}</div></div>+ {sequenceFrameInfo ? (+ <div+ style={{+ height: '100%',+ left: negativeStartEnd + 5 + (premount?.width ?? 0),+ pointerEvents: 'none',+ position: 'absolute',+ top: 0,+ }}+ >+ {sequenceFrameInfo}+ </div>+ ) : null}</>) : (content