diff --git a/web/src/views/motion-search/MotionSearchDialog.tsx b/web/src/views/motion-search/MotionSearchDialog.tsx index 72f3497364..5b622c1607 100644 --- a/web/src/views/motion-search/MotionSearchDialog.tsx +++ b/web/src/views/motion-search/MotionSearchDialog.tsx @@ -112,35 +112,8 @@ export default function MotionSearchDialog({ }: MotionSearchDialogProps) { const { t } = useTranslation(["views/motionSearch", "common"]); const apiHost = useApiHost(); - const [containerNode, setContainerNode] = useState( - null, - ); - const [containerSize, setContainerSize] = useState({ width: 0, height: 0 }); - const containerWidth = containerSize.width; - const containerHeight = containerSize.height; const [imageLoaded, setImageLoaded] = useState(false); - useEffect(() => { - if (!containerNode) { - return; - } - - const measure = () => { - const rect = containerNode.getBoundingClientRect(); - setContainerSize((prev) => - prev.width === rect.width && prev.height === rect.height - ? prev - : { width: rect.width, height: rect.height }, - ); - }; - - measure(); - - const observer = new ResizeObserver(() => measure()); - observer.observe(containerNode); - return () => observer.disconnect(); - }, [containerNode]); - const cameraConfig = useMemo(() => { if (!selectedCamera) return undefined; return config.cameras[selectedCamera]; @@ -169,28 +142,6 @@ export default function MotionSearchDialog({ setIsDrawingROI(true); }, [isSearching, polygonPoints.length, setIsDrawingROI, setPolygonPoints]); - const imageSize = useMemo(() => { - if (!containerWidth || !containerHeight || !cameraConfig) { - return { width: 0, height: 0 }; - } - - const cameraAspectRatio = - cameraConfig.detect.width / cameraConfig.detect.height; - const availableAspectRatio = containerWidth / containerHeight; - - if (availableAspectRatio >= cameraAspectRatio) { - return { - width: containerHeight * cameraAspectRatio, - height: containerHeight, - }; - } - - return { - width: containerWidth, - height: containerWidth / cameraAspectRatio, - }; - }, [containerWidth, containerHeight, cameraConfig]); - useEffect(() => { setImageLoaded(false); }, [selectedCamera]); @@ -280,19 +231,9 @@ export default function MotionSearchDialog({ height: "100%", }} > -
+
{selectedCamera && cameraConfig ? ( -
+