From 83be2800f9a299835c6a59e5bce724c6e5eeb3af Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 18 Mar 2026 08:15:30 +0000 Subject: [PATCH] fix: motion dot outside zoom transform, fix activeMotion logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two fixes: 1. useCameraActivity: replace broken ternary priority with OR — "OFF" (truthy string) was silently blocking camera_activity.motion fallback. Now: motion === true (from camera_activity) OR detectingMotion === "ON". 2. DraggableGridLayout: render CameraMotionDot outside the zoom transform div so the dot doesn't scale with camera zoom. LivePlayer gets showMotionDot={false} to avoid duplicate rendering. https://claude.ai/code/session_019B4dJXtcxvHn97ZaqHUB62 --- web/src/hooks/use-camera-activity.ts | 4 +--- web/src/views/live/DraggableGridLayout.tsx | 9 +++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/web/src/hooks/use-camera-activity.ts b/web/src/hooks/use-camera-activity.ts index 76a982725..112812f2c 100644 --- a/web/src/hooks/use-camera-activity.ts +++ b/web/src/hooks/use-camera-activity.ts @@ -176,9 +176,7 @@ export function useCameraActivity( enabled: isCameraEnabled, activeTracking: isCameraEnabled ? hasActiveObjects : false, activeMotion: isCameraEnabled - ? detectingMotion - ? detectingMotion === "ON" - : updatedCameraState?.motion === true + ? updatedCameraState?.motion === true || detectingMotion === "ON" : false, objects: isCameraEnabled ? (objects ?? []) : [], audio_detections: isCameraEnabled ? (audioDetections ?? []) : [], diff --git a/web/src/views/live/DraggableGridLayout.tsx b/web/src/views/live/DraggableGridLayout.tsx index 5d36ca1ba..e26c3071e 100644 --- a/web/src/views/live/DraggableGridLayout.tsx +++ b/web/src/views/live/DraggableGridLayout.tsx @@ -32,6 +32,8 @@ import { PlayerStats } from "@/components/player/PlayerStats"; import { MdCircle } from "react-icons/md"; import { useCameraActivity } from "@/hooks/use-camera-activity"; import { Skeleton } from "@/components/ui/skeleton"; +import { MdCircle } from "react-icons/md"; +import { useCameraActivity } from "@/hooks/use-camera-activity"; import { isEqual } from "lodash"; import useSWR from "swr"; @@ -1081,9 +1083,8 @@ const BirdseyeLivePlayerGridItem = React.forwardRef< }, ); -// Separate component so it can call useCameraActivity as a hook (no hooks in loops). -// Direct WS subscription guarantees the dot reacts to motion changes in real-time -// without relying on an intermediate callback → parent-state chain. +// Separate component so useCameraActivity can be called as a hook (no hooks in loops). +// Rendered outside the zoom transform div so it doesn't scale with the camera zoom. function CameraMotionDot({ camera, autoLive, @@ -1095,7 +1096,7 @@ function CameraMotionDot({ if (autoLive === false || offline || !activeMotion) return null; return (
- +
); }