mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-07 03:35:26 +03:00
Cleanup
This commit is contained in:
parent
d9c0798ab5
commit
9bc67e9ab8
@ -45,9 +45,11 @@ export default function CameraImage({
|
||||
const aspectRatio = width / height;
|
||||
|
||||
const scaledHeight = useMemo(() => {
|
||||
const scaledHeight = (aspectRatio < (fitAspect ?? 0)) ? Math.floor(containerHeight) : Math.floor(availableWidth / aspectRatio);
|
||||
const scaledHeight =
|
||||
aspectRatio < (fitAspect ?? 0)
|
||||
? Math.floor(containerHeight)
|
||||
: Math.floor(availableWidth / aspectRatio);
|
||||
const finalHeight = stretch ? scaledHeight : Math.min(scaledHeight, height);
|
||||
console.log("returning " + containerHeight + " for " + camera)
|
||||
|
||||
if (finalHeight > 0) {
|
||||
return finalHeight;
|
||||
@ -83,7 +85,12 @@ export default function CameraImage({
|
||||
}, [apiHost, canvasRef, name, img, searchParams, scaledHeight, config]);
|
||||
|
||||
return (
|
||||
<div className={`relative w-full ${fitAspect && aspectRatio < fitAspect ? 'h-full flex justify-center' : ''}`} ref={containerRef}>
|
||||
<div
|
||||
className={`relative w-full ${
|
||||
fitAspect && aspectRatio < fitAspect ? "h-full flex justify-center" : ""
|
||||
}`}
|
||||
ref={containerRef}
|
||||
>
|
||||
{enabled ? (
|
||||
<canvas
|
||||
data-testid="cameraimage-canvas"
|
||||
|
||||
@ -79,6 +79,7 @@ function Camera({ camera }: { camera: CameraConfig }) {
|
||||
<div>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className={`${
|
||||
detectValue == "ON" ? "text-primary" : "text-gray-400"
|
||||
}`}
|
||||
@ -88,6 +89,7 @@ function Camera({ camera }: { camera: CameraConfig }) {
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className={
|
||||
camera.record.enabled_in_config
|
||||
? recordValue == "ON"
|
||||
@ -105,6 +107,7 @@ function Camera({ camera }: { camera: CameraConfig }) {
|
||||
</Button>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className={`${
|
||||
snapshotValue == "ON" ? "text-primary" : "text-gray-400"
|
||||
}`}
|
||||
@ -115,6 +118,7 @@ function Camera({ camera }: { camera: CameraConfig }) {
|
||||
{camera.audio.enabled_in_config && (
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
className={`${
|
||||
audioValue == "ON" ? "text-primary" : "text-gray-400"
|
||||
}`}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user