Skip to content

Commit

Permalink
Set a better aspect ratio on screens 🖥️.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmarty committed May 26, 2024
1 parent 0d1bac0 commit 82c74b2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/containers/ScreenCanvasContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ const ScreenCanvasContainer = ({
const canvasRef = useRef(null);
const [isComputing, setIsComputing] = useState(true);
const { width, height } = screen.header;
// Aspect ratio of 5:4 for all possible screen sizes.
const ratio =
width === 28
? 'aspect-[4.375/2.133333333333333]'
: width === 60
? 'aspect-[9.375/2.133333333333333]'
: 'aspect-[5/4]';

useEffect(() => {
const canvas = canvasRef.current;
Expand All @@ -34,6 +41,7 @@ const ScreenCanvasContainer = ({
width={width * 8}
height={height * 8}
className={clsx(
ratio,
'w-full rounded',
isComputing ? 'opacity-0' : 'opacity-100 transition-opacity',
)}
Expand Down

0 comments on commit 82c74b2

Please sign in to comment.