Skip to content

Commit

Permalink
calculate aspect ratio of container to prevent overflow (#11495)
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye217 committed May 23, 2024
1 parent 4d05bc2 commit 058e9a3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions web/src/components/settings/MasksAndZones.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 058e9a3

Please sign in to comment.