Skip to content

Commit

Permalink
Merge pull request #4267 from remotion-dev/fix-rulers
Browse files Browse the repository at this point in the history
  • Loading branch information
JonnyBurger authored Sep 3, 2024
2 parents 5acf2e8 + cb973af commit 39869a3
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/studio/src/components/TopPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,22 @@ export const TopPanel: React.FC<{
[rulersAreVisible],
);

const sizeWithRulersApplied = useMemo(() => {
if (!rulersAreVisible) {
return size;
}

if (!size) {
return null;
}

return {
...size,
width: size.width - RULER_WIDTH,
height: size.height - RULER_WIDTH,
};
}, [rulersAreVisible, size]);

const onCollapseLeft = useCallback(() => {
setSidebarCollapsedState({left: 'collapsed', right: null});
}, [setSidebarCollapsedState]);
Expand Down Expand Up @@ -142,7 +158,9 @@ export const TopPanel: React.FC<{
>
<SplitterElement sticky={null} type="flexer">
<div ref={drawRef} style={canvasContainerStyle}>
{size ? <CanvasOrLoading size={size} /> : null}
{sizeWithRulersApplied ? (
<CanvasOrLoading size={sizeWithRulersApplied} />
) : null}
</div>
</SplitterElement>
{actualStateRight === 'expanded' ? (
Expand Down

0 comments on commit 39869a3

Please sign in to comment.