mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-06-30 00:51:14 +03:00
improve motion search layout to match tracking details
This commit is contained in:
parent
c2d1583397
commit
a3c46e45fd
@ -6,6 +6,7 @@ import { MdOutlineRestartAlt, MdUndo } from "react-icons/md";
|
|||||||
|
|
||||||
import { FrigateConfig } from "@/types/frigateConfig";
|
import { FrigateConfig } from "@/types/frigateConfig";
|
||||||
import { TimeRange } from "@/types/timeline";
|
import { TimeRange } from "@/types/timeline";
|
||||||
|
import { ASPECT_PORTRAIT_LAYOUT, ASPECT_WIDE_LAYOUT } from "@/types/record";
|
||||||
|
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
import {
|
import {
|
||||||
@ -119,6 +120,27 @@ export default function MotionSearchDialog({
|
|||||||
return config.cameras[selectedCamera];
|
return config.cameras[selectedCamera];
|
||||||
}, [config, selectedCamera]);
|
}, [config, selectedCamera]);
|
||||||
|
|
||||||
|
const aspectRatio = useMemo(() => {
|
||||||
|
if (!cameraConfig) {
|
||||||
|
return 16 / 9;
|
||||||
|
}
|
||||||
|
|
||||||
|
return cameraConfig.detect.width / cameraConfig.detect.height;
|
||||||
|
}, [cameraConfig]);
|
||||||
|
|
||||||
|
// Determine camera aspect ratio category
|
||||||
|
const cameraAspect = useMemo(() => {
|
||||||
|
if (!aspectRatio) {
|
||||||
|
return "normal";
|
||||||
|
} else if (aspectRatio > ASPECT_WIDE_LAYOUT) {
|
||||||
|
return "wide";
|
||||||
|
} else if (aspectRatio < ASPECT_PORTRAIT_LAYOUT) {
|
||||||
|
return "tall";
|
||||||
|
} else {
|
||||||
|
return "normal";
|
||||||
|
}
|
||||||
|
}, [aspectRatio]);
|
||||||
|
|
||||||
const polygonClosed = useMemo(
|
const polygonClosed = useMemo(
|
||||||
() => !isDrawingROI && polygonPoints.length >= 3,
|
() => !isDrawingROI && polygonPoints.length >= 3,
|
||||||
[isDrawingROI, polygonPoints.length],
|
[isDrawingROI, polygonPoints.length],
|
||||||
@ -231,7 +253,15 @@ export default function MotionSearchDialog({
|
|||||||
height: "100%",
|
height: "100%",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="relative flex aspect-video w-full items-center justify-center overflow-hidden rounded-lg border bg-secondary">
|
<div
|
||||||
|
className={cn(
|
||||||
|
"relative mx-auto flex items-center justify-center overflow-hidden rounded-lg border bg-secondary",
|
||||||
|
cameraAspect === "tall"
|
||||||
|
? "max-h-[50dvh] lg:max-h-[60dvh]"
|
||||||
|
: "w-full",
|
||||||
|
)}
|
||||||
|
style={{ aspectRatio }}
|
||||||
|
>
|
||||||
{selectedCamera && cameraConfig ? (
|
{selectedCamera && cameraConfig ? (
|
||||||
<div className="relative h-full w-full">
|
<div className="relative h-full w-full">
|
||||||
<img
|
<img
|
||||||
@ -370,7 +400,7 @@ export default function MotionSearchDialog({
|
|||||||
<Slider
|
<Slider
|
||||||
id="frameSkip"
|
id="frameSkip"
|
||||||
min={1}
|
min={1}
|
||||||
max={60}
|
max={120}
|
||||||
step={1}
|
step={1}
|
||||||
value={[frameSkip]}
|
value={[frameSkip]}
|
||||||
onValueChange={([value]) => setFrameSkip(value)}
|
onValueChange={([value]) => setFrameSkip(value)}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user