Skip to content

NVR with realtime local object detection for IP cameras

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

Josh Hawkins058e9a3ba060
diff --git a/web/src/components/settings/MasksAndZones.tsx b/web/src/components/settings/MasksAndZones.tsx
index 09659906ab..628f99d5ee 100644
--- a/web/src/components/settings/MasksAndZones.tsx
+++ b/web/src/components/settings/MasksAndZones.tsx
@@ -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) {