Skip to content

🎥 Make videos programmatically with React

fix(studio): Keep timeline labels visible when ticks scroll offscreen

Jonny Burger929d2e5bfbb3
diff --git a/packages/studio/src/components/Timeline/TimelineTimeIndicators.tsx b/packages/studio/src/components/Timeline/TimelineTimeIndicators.tsx
index 949d640309..229a5da8ec 100644
--- a/packages/studio/src/components/Timeline/TimelineTimeIndicators.tsx
+++ b/packages/studio/src/components/Timeline/TimelineTimeIndicators.tsx
@@ -301,7 +301,14 @@ const TimelineTimeIndicatorsInner = React.memo<{
const firstFrame = Math.max(
0,
- Math.floor((scrollLeft - TIMELINE_PADDING) / frameInterval),
+ // Keep labels visible after their ticks scroll out of the viewport.
+ Math.floor(
+ (scrollLeft -
+ TIMELINE_PADDING -
+ TICK_LABEL_MARGIN_LEFT -
+ maxTickLabelWidth) /
+ frameInterval,
+ ),
);
const lastFrame = Math.min(
durationInFrames - 1,