Skip to content

🎥 Make videos programmatically with React

fix display when layer amount has been cut

Jonny Burgerd38fa0558fd3
diff --git a/packages/cli/src/editor/components/Timeline/MaxTimelineTracks.tsx b/packages/cli/src/editor/components/Timeline/MaxTimelineTracks.tsx
index 604b9b14a5..dfbbf4e8f1 100644
--- a/packages/cli/src/editor/components/Timeline/MaxTimelineTracks.tsx
+++ b/packages/cli/src/editor/components/Timeline/MaxTimelineTracks.tsx
@@ -6,9 +6,12 @@ export const MAX_TIMELINE_TRACKS =
? 15
: Number(process.env.MAX_TIMELINE_TRACKS);
+export const MAX_TIMELINE_TRACKS_NOTICE_HEIGHT = 24;
+
const container: React.CSSProperties = {
- paddingTop: 6,
- paddingBottom: 6,
+ height: MAX_TIMELINE_TRACKS_NOTICE_HEIGHT,
+ display: 'flex',
+ alignItems: 'center',
color: 'rgba(255, 255, 255, 0.6)',
fontFamily: 'sans-serif',
fontSize: 12,
diff --git a/packages/cli/src/editor/components/Timeline/Timeline.tsx b/packages/cli/src/editor/components/Timeline/Timeline.tsx
index 705e3bdd69..e87175f47a 100644
--- a/packages/cli/src/editor/components/Timeline/Timeline.tsx
+++ b/packages/cli/src/editor/components/Timeline/Timeline.tsx
@@ -77,16 +77,19 @@ export const Timeline: React.FC = () => {
}, [state, timeline]);
const shown = withoutHidden.slice(0, MAX_TIMELINE_TRACKS);
+ const hasBeenCut = withoutHidden.length > shown.length;
const inner: React.CSSProperties = useMemo(() => {
return {
- height: shown.length * (TIMELINE_LAYER_HEIGHT + TIMELINE_BORDER * 2),
+ height:
+ shown.length * (TIMELINE_LAYER_HEIGHT + TIMELINE_BORDER * 2) +
+ (hasBeenCut ? 24 : 0),
display: 'flex',
flex: 1,
minHeight: '100%',
overflowX: 'hidden',
};
- }, [shown.length]);
+ }, [hasBeenCut, shown.length]);
if (!videoConfig) {
return null;
@@ -116,7 +119,7 @@ export const Timeline: React.FC = () => {
viewState={state}
timeline={shown}
fps={videoConfig.fps}
- hasBeenCut={withoutHidden.length > shown.length}
+ hasBeenCut={hasBeenCut}
/>
<TimelineInOutPointer />
<TimelineDragHandler />
diff --git a/packages/cli/src/editor/components/Timeline/TimelineScrollable.tsx b/packages/cli/src/editor/components/Timeline/TimelineScrollable.tsx
index 68ee991177..473883c3c9 100644
--- a/packages/cli/src/editor/components/Timeline/TimelineScrollable.tsx
+++ b/packages/cli/src/editor/components/Timeline/TimelineScrollable.tsx
@@ -15,7 +15,7 @@ export const TimelineScrollable: React.FC<{
const containerStyle: React.CSSProperties = useMemo(() => {
return {
width: '100%',
- height: '100%',
+ minHeight: '100%',
};
}, []);
diff --git a/packages/cli/src/editor/components/Timeline/TimelineTracks.tsx b/packages/cli/src/editor/components/Timeline/TimelineTracks.tsx
index f09eba5143..486c8c65fd 100644
--- a/packages/cli/src/editor/components/Timeline/TimelineTracks.tsx
+++ b/packages/cli/src/editor/components/Timeline/TimelineTracks.tsx
@@ -13,11 +13,10 @@ import {TimelineSequence} from './TimelineSequence';
const content: React.CSSProperties = {
paddingLeft: TIMELINE_PADDING,
paddingRight: TIMELINE_PADDING,
- overflow: 'auto',
};
const timelineContent: React.CSSProperties = {
- height: '100%',
+ minHeight: '100%',
};
export const TimelineTracks: React.FC<{