calculate aspect ratio of container to prevent overflow

This commit is contained in:
Josh Hawkins 2024-05-23 08:12:08 -05:00
parent c49be0a47f
commit 226ff51af6

View File

@ -98,8 +98,11 @@ export default function MasksAndZones({
}, [config, selectedCamera]); }, [config, selectedCamera]);
const stretch = true; const stretch = true;
// may need tweaking for mobile
const fitAspect = isDesktop ? 16 / 9 : 3 / 4; const fitAspect = useMemo(
() => (isDesktop ? containerWidth / containerHeight : 3 / 4),
[containerWidth, containerHeight],
);
const scaledHeight = useMemo(() => { const scaledHeight = useMemo(() => {
if (containerRef.current && aspectRatio && detectHeight) { if (containerRef.current && aspectRatio && detectHeight) {