Skip to content

🎥 Make videos programmatically with React

`@remotion/studio`: Fix rounding issues of timeline layers

Jonny Burgere98020cb7071
diff --git a/packages/studio/src/components/Timeline/TimelineTracks.tsx b/packages/studio/src/components/Timeline/TimelineTracks.tsx
index bad4c7a46b..efd287e4ac 100644
--- a/packages/studio/src/components/Timeline/TimelineTracks.tsx
+++ b/packages/studio/src/components/Timeline/TimelineTracks.tsx
@@ -21,8 +21,8 @@ const timelineContent: React.CSSProperties = {
};
export const TimelineTracks: React.FC<{
- timeline: TrackWithHash[];
- hasBeenCut: boolean;
+ readonly timeline: TrackWithHash[];
+ readonly hasBeenCut: boolean;
}> = ({timeline, hasBeenCut}) => {
const inner: React.CSSProperties = useMemo(() => {
return {
diff --git a/packages/studio/src/helpers/get-timeline-sequence-layout.ts b/packages/studio/src/helpers/get-timeline-sequence-layout.ts
index ad63ad2576..4723d9ce59 100644
--- a/packages/studio/src/helpers/get-timeline-sequence-layout.ts
+++ b/packages/studio/src/helpers/get-timeline-sequence-layout.ts
@@ -74,30 +74,26 @@ export const getTimelineSequenceLayout = ({
const nonNegativeMarginLeft = Math.min(marginLeft, 0);
- const width = Math.floor(
- getWidthOfTrack({
- durationInFrames,
- lastFrame,
- nonNegativeMarginLeft,
- spatialDuration,
- windowWidth,
- }),
- );
+ const width = getWidthOfTrack({
+ durationInFrames,
+ lastFrame,
+ nonNegativeMarginLeft,
+ spatialDuration,
+ windowWidth,
+ });
const premountWidth = premountDisplay
- ? Math.floor(
- getWidthOfTrack({
- durationInFrames: premountDisplay,
- lastFrame,
- nonNegativeMarginLeft,
- spatialDuration: premountDisplay,
- windowWidth,
- }),
- )
+ ? getWidthOfTrack({
+ durationInFrames: premountDisplay,
+ lastFrame,
+ nonNegativeMarginLeft,
+ spatialDuration: premountDisplay,
+ windowWidth,
+ })
: null;
return {
- marginLeft: Math.round(Math.max(marginLeft, 0)) - (premountWidth ?? 0),
+ marginLeft: Math.max(marginLeft, 0) - (premountWidth ?? 0),
width: width + (premountWidth ?? 0),
premountWidth,
};