don't set aspect ratio on fullscreen

This commit is contained in:
Josh Hawkins 2024-03-05 14:12:50 -06:00
parent f4b7c81909
commit 90c7273f6a

View File

@ -117,9 +117,9 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
if (fullscreen) { if (fullscreen) {
if (aspect > 16 / 9) { if (aspect > 16 / 9) {
return "absolute inset-x-0 top-[50%] -translate-y-[50%]"; return "absolute inset-x-2 top-[50%] -translate-y-[50%]";
} else { } else {
return "absolute inset-y-0 left-[50%] -translate-x-[50%]"; return "absolute inset-y-2 left-[50%] -translate-x-[50%]";
} }
} else { } else {
return "absolute top-2 bottom-2 left-[50%] -translate-x-[50%]"; return "absolute top-2 bottom-2 left-[50%] -translate-x-[50%]";
@ -135,14 +135,14 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
}, [camera]); }, [camera]);
const aspectRatio = useMemo<number>(() => { const aspectRatio = useMemo<number>(() => {
if (isMobile) { if (isMobile || fullscreen) {
return cameraAspectRatio; return cameraAspectRatio;
} else { } else {
return windowAspectRatio < cameraAspectRatio return windowAspectRatio < cameraAspectRatio
? windowAspectRatio - 0.05 ? windowAspectRatio - 0.05
: cameraAspectRatio - 0.03; : cameraAspectRatio - 0.03;
} }
}, [cameraAspectRatio, windowAspectRatio]); }, [cameraAspectRatio, windowAspectRatio, fullscreen]);
return ( return (
<div <div