Skip to content

🎥 Make videos programmatically with React

Revert PR #12062: Restore previous timeline overlay layout

Jonny Burgeref546053f5a0
diff --git a/packages/studio/src/components/Splitter/SplitterElement.tsx b/packages/studio/src/components/Splitter/SplitterElement.tsx
index 0100ea7bcf..222d92c5be 100644
--- a/packages/studio/src/components/Splitter/SplitterElement.tsx
+++ b/packages/studio/src/components/Splitter/SplitterElement.tsx
@@ -1,21 +1,13 @@
import React, {useContext, useMemo} from 'react';
+import {interpolateColors, random} from 'remotion';
import {SplitterContext} from './SplitterContext';
-const stickyStyle: React.CSSProperties = {
- position: 'sticky',
- top: 0,
- height: 0,
- flexShrink: 0,
- zIndex: 1,
-};
-
export const SplitterElement: React.FC<{
readonly type: 'flexer' | 'anti-flexer';
readonly children: React.ReactNode;
readonly sticky: React.ReactNode | null;
}> = ({children, type, sticky}) => {
const context = useContext(SplitterContext);
- const hasSticky = sticky !== null;
const maxSize =
type === 'flexer' ? context.maxFlexerSize : context.maxAntiFlexerSize;
const minSize =
@@ -31,8 +23,7 @@ export const SplitterElement: React.FC<{
? 'none'
: 'flex',
position: 'relative',
- // Clip the overlay without making this panel the sticky scrollport.
- overflow: hasSticky ? 'clip' : 'hidden',
+ overflow: 'hidden',
flexDirection: 'column',
maxWidth:
context.orientation === 'vertical' ? (maxSize ?? undefined) : undefined,
@@ -40,7 +31,8 @@ export const SplitterElement: React.FC<{
context.orientation === 'horizontal'
? (maxSize ?? undefined)
: undefined,
- minWidth: context.orientation === 'vertical' ? (minSize ?? 0) : 0,
+ minWidth:
+ context.orientation === 'vertical' ? (minSize ?? undefined) : undefined,
minHeight:
context.orientation === 'horizontal'
? (minSize ?? undefined)
@@ -50,20 +42,30 @@ export const SplitterElement: React.FC<{
context.collapsedDuringDrag,
context.flexValue,
context.orientation,
- hasSticky,
maxSize,
minSize,
type,
]);
+ const stickStyle: React.CSSProperties = useMemo(() => {
+ return {
+ position: 'absolute',
+ left: (type === 'flexer' ? 0 : context.flexValue) * 100 + '%',
+ width:
+ (type === 'flexer' ? context.flexValue : 1 - context.flexValue) * 100 +
+ '%',
+ backgroundColor: interpolateColors(
+ random(context.flexValue),
+ [0, 1],
+ ['red', 'blue'],
+ ),
+ };
+ }, [context.flexValue, type]);
+
return (
- <div style={style}>
- {hasSticky ? (
- // Share the panel's actual width while staying pinned to the
- // timeline's vertical scrollport.
- <div style={stickyStyle}>{sticky}</div>
- ) : null}
- {children}
- </div>
+ <>
+ <div style={style}>{children}</div>
+ <div style={stickStyle}>{sticky ?? null}</div>
+ </>
);
};
diff --git a/packages/studio/src/components/Timeline/TimelineHeightContainer.tsx b/packages/studio/src/components/Timeline/TimelineHeightContainer.tsx
index 90a13cea21..33a2166e4f 100644
--- a/packages/studio/src/components/Timeline/TimelineHeightContainer.tsx
+++ b/packages/studio/src/components/Timeline/TimelineHeightContainer.tsx
@@ -6,10 +6,9 @@ const baseStyle: React.CSSProperties = {
display: 'flex',
flex: 1,
minHeight: '100%',
- // Keep the sticky ruler and timeline overlays below modals.
+ // Keep timeline overlays below modals.
isolation: 'isolate',
- // Clip horizontally without creating a scroll container for the sticky ruler.
- overflowX: 'clip',
+ overflowX: 'hidden',
backgroundColor: TIMELINE_BACKGROUND,
};