calculate aspect ratio of container to prevent overflow (#11495)

This commit is contained in:
Josh Hawkins
2024-05-23 08:30:16 -05:00
committed by GitHub
parent 4d05bc25f4
commit 058e9a3ba0

View File

@@ -98,8 +98,11 @@ export default function MasksAndZones({
}, [config, selectedCamera]);
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(() => {
if (containerRef.current && aspectRatio && detectHeight) {