From 2c3e2f94089e42be5c20782739204feb007b78dd Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Tue, 1 Oct 2024 07:05:22 -0500 Subject: [PATCH] improve image loading skeleton in object lifecycle pane --- .../overlay/detail/ObjectLifecycle.tsx | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/web/src/components/overlay/detail/ObjectLifecycle.tsx b/web/src/components/overlay/detail/ObjectLifecycle.tsx index c2da8ec36..fb27966df 100644 --- a/web/src/components/overlay/detail/ObjectLifecycle.tsx +++ b/web/src/components/overlay/detail/ObjectLifecycle.tsx @@ -77,6 +77,17 @@ export default function ObjectLifecycle({ const [showControls, setShowControls] = useState(false); const [showZones, setShowZones] = useState(true); + const aspectRatio = useMemo(() => { + if (!config) { + return 16 / 9; + } + + return ( + config.cameras[event.camera].detect.width / + config.cameras[event.camera].detect.height + ); + }, [config, event]); + const getZoneColor = useCallback( (zoneName: string) => { const zoneColor = @@ -240,7 +251,15 @@ export default function ObjectLifecycle({ )} -
+