Skip to content

🎥 Make videos programmatically with React

fix(studio): clip negative sequence frame info

Jonny Burger95b205a1e00e
diff --git a/packages/example/e2e/studio.test.mts b/packages/example/e2e/studio.test.mts
index c13ae1ea96..b5a6ff4c6f 100644
--- a/packages/example/e2e/studio.test.mts
+++ b/packages/example/e2e/studio.test.mts
@@ -420,18 +420,28 @@ test.describe('visual mode', () => {
const negativeSequence = page.locator(
'[data-timeline-marquee-item][title="Negative start"]',
);
+ const negativeSequenceWithoutFreeze = page.locator(
+ '[data-timeline-marquee-item][title="Negative start without freeze"]',
+ );
const zeroSequence = page.locator(
'[data-timeline-marquee-item][title="Zero start"]',
);
await expect(negativeSequence).toBeVisible();
+ await expect(negativeSequenceWithoutFreeze).toBeVisible();
await expect(zeroSequence).toBeVisible();
const negativeSequenceFrame = negativeSequence.locator(
'[data-timeline-sequence-frame]',
);
+ const negativeSequenceFrameWithoutFreeze =
+ negativeSequenceWithoutFreeze.locator('[data-timeline-sequence-frame]');
await expect(negativeSequenceFrame).toContainText('20');
await expect(negativeSequenceFrame.locator('svg')).toHaveCount(1);
- const sequenceFrameIsClipped = () =>
- negativeSequence.evaluate((element) => {
+ await expect(negativeSequenceFrameWithoutFreeze).toContainText('20');
+ await expect(negativeSequenceFrameWithoutFreeze.locator('svg')).toHaveCount(
+ 0,
+ );
+ const sequenceFrameIsClipped = (sequence: Locator) =>
+ sequence.evaluate((element) => {
const frame = element.querySelector('[data-timeline-sequence-frame]');
if (!frame) {
return true;
@@ -482,12 +492,16 @@ test.describe('visual mode', () => {
(element) => getComputedStyle(element).overflow,
),
).toBe('visible');
- expect(await sequenceFrameIsClipped()).toBe(true);
+ expect(await sequenceFrameIsClipped(negativeSequence)).toBe(true);
+ expect(await sequenceFrameIsClipped(negativeSequenceWithoutFreeze)).toBe(
+ true,
+ );
await page.getByRole('button', {name: 'Step forward one frame'}).click();
await expect(negativeSequenceFrame).toContainText('20');
await expect(negativeSequenceFrame.locator('svg')).toHaveCount(1);
- expect(await sequenceFrameIsClipped()).toBe(true);
+ await expect(negativeSequenceFrameWithoutFreeze).toHaveCount(0);
+ expect(await sequenceFrameIsClipped(negativeSequence)).toBe(true);
});
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.tsx
index 2f088a7499..de9b1bcf2d 100644
--- a/packages/example/src/TimelineNegativeFromResize/index.tsx
+++ b/packages/example/src/TimelineNegativeFromResize/index.tsx
@@ -15,6 +15,13 @@ export const TimelineNegativeFromResize: React.FC = () => {
>
<Starburst rays={16} colors={['#ffdd00', '#ff8800']} />
</Sequence>
+ <Sequence
+ name="Negative start without freeze"
+ from={-20}
+ durationInFrames={21}
+ >
+ <div />
+ </Sequence>
</AbsoluteFill>
<Sequence name="Zero start" durationInFrames={36}>
<div />
diff --git a/packages/studio/src/components/Timeline/TimelineSequence.tsx b/packages/studio/src/components/Timeline/TimelineSequence.tsx
index 30d687f117..c1c6dbc802 100644
--- a/packages/studio/src/components/Timeline/TimelineSequence.tsx
+++ b/packages/studio/src/components/Timeline/TimelineSequence.tsx
@@ -253,8 +253,6 @@ const TimelineSequenceCurrentFrame: React.FC<{
relativeFrameWithPostmount >= 0 &&
relativeFrameWithPostmount < (s.postmountDisplay ?? 0) &&
!isInRange;
- const allowSequenceFrameOverflow =
- frozenFrame === null && (isInRange || isPremounting || isPostmounting);
const negativeStartEnd = negativeStart
? negativeStart.left + negativeStart.width
: 0;
@@ -277,7 +275,7 @@ const TimelineSequenceCurrentFrame: React.FC<{
s.type !== 'video' &&
s.type !== 'image' &&
s.loopDisplay === undefined &&
- (frozenFrame !== null || allowSequenceFrameOverflow);
+ (frozenFrame !== null || isInRange || isPremounting || isPostmounting);
const sequenceFrameInfo = showSequenceFrame ? (
<div
data-timeline-sequence-frame
@@ -397,7 +395,7 @@ const TimelineSequenceCurrentFrame: React.FC<{
>
{content}
</div>
- {sequenceFrameInfo && !allowSequenceFrameOverflow ? (
+ {sequenceFrameInfo ? (
<div
style={{
height: '100%',
@@ -411,19 +409,6 @@ const TimelineSequenceCurrentFrame: React.FC<{
</div>
) : null}
</div>
- {sequenceFrameInfo && allowSequenceFrameOverflow ? (
- <div
- style={{
- height: '100%',
- left: negativeStartEnd + 5 + (premount?.width ?? 0),
- pointerEvents: 'none',
- position: 'absolute',
- top: 0,
- }}
- >
- {sequenceFrameInfo}
- </div>
- ) : null}
</>
) : (
content