mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-05 22:57:40 +03:00
fix: motion dot outside zoom transform, fix activeMotion logic
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
This commit is contained in:
parent
18321ac16f
commit
83be2800f9
@ -176,9 +176,7 @@ export function useCameraActivity(
|
|||||||
enabled: isCameraEnabled,
|
enabled: isCameraEnabled,
|
||||||
activeTracking: isCameraEnabled ? hasActiveObjects : false,
|
activeTracking: isCameraEnabled ? hasActiveObjects : false,
|
||||||
activeMotion: isCameraEnabled
|
activeMotion: isCameraEnabled
|
||||||
? detectingMotion
|
? updatedCameraState?.motion === true || detectingMotion === "ON"
|
||||||
? detectingMotion === "ON"
|
|
||||||
: updatedCameraState?.motion === true
|
|
||||||
: false,
|
: false,
|
||||||
objects: isCameraEnabled ? (objects ?? []) : [],
|
objects: isCameraEnabled ? (objects ?? []) : [],
|
||||||
audio_detections: isCameraEnabled ? (audioDetections ?? []) : [],
|
audio_detections: isCameraEnabled ? (audioDetections ?? []) : [],
|
||||||
|
|||||||
@ -32,6 +32,8 @@ import { PlayerStats } from "@/components/player/PlayerStats";
|
|||||||
import { MdCircle } from "react-icons/md";
|
import { MdCircle } from "react-icons/md";
|
||||||
import { useCameraActivity } from "@/hooks/use-camera-activity";
|
import { useCameraActivity } from "@/hooks/use-camera-activity";
|
||||||
import { Skeleton } from "@/components/ui/skeleton";
|
import { Skeleton } from "@/components/ui/skeleton";
|
||||||
|
import { MdCircle } from "react-icons/md";
|
||||||
|
import { useCameraActivity } from "@/hooks/use-camera-activity";
|
||||||
|
|
||||||
import { isEqual } from "lodash";
|
import { isEqual } from "lodash";
|
||||||
import useSWR from "swr";
|
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).
|
// Separate component so useCameraActivity can be called as a hook (no hooks in loops).
|
||||||
// Direct WS subscription guarantees the dot reacts to motion changes in real-time
|
// Rendered outside the zoom transform div so it doesn't scale with the camera zoom.
|
||||||
// without relying on an intermediate callback → parent-state chain.
|
|
||||||
function CameraMotionDot({
|
function CameraMotionDot({
|
||||||
camera,
|
camera,
|
||||||
autoLive,
|
autoLive,
|
||||||
@ -1095,7 +1096,7 @@ function CameraMotionDot({
|
|||||||
if (autoLive === false || offline || !activeMotion) return null;
|
if (autoLive === false || offline || !activeMotion) return null;
|
||||||
return (
|
return (
|
||||||
<div className="absolute right-2 top-2 z-40">
|
<div className="absolute right-2 top-2 z-40">
|
||||||
<MdCircle className="mr-2 size-2 animate-pulse text-danger shadow-danger drop-shadow-md" />
|
<MdCircle className="size-2 animate-pulse text-danger drop-shadow-md" />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user