Fix zoom scaling for live view (#10479)

This commit is contained in:
Nicolas Mowen 2024-03-15 08:57:58 -06:00 committed by GitHub
parent f5a26c5962
commit df0291db5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -157,6 +157,7 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
}, [cameraAspectRatio, windowAspectRatio, fullscreen]);
return (
<TransformWrapper minScale={1.0}>
<div
ref={mainRef}
className={
@ -242,7 +243,9 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
Icon={snapshotState == "ON" ? MdPhotoCamera : MdNoPhotography}
isActive={snapshotState == "ON"}
title={`${snapshotState == "ON" ? "Disable" : "Enable"} Snapshots`}
onClick={() => sendSnapshot(snapshotState == "ON" ? "OFF" : "ON")}
onClick={() =>
sendSnapshot(snapshotState == "ON" ? "OFF" : "ON")
}
/>
{camera.audio.enabled_in_config && (
<CameraFeatureToggle
@ -257,15 +260,24 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
</div>
</TooltipProvider>
</div>
<div className="relative size-full p-2">
<TransformComponent
wrapperStyle={{
width: "100%",
height: "100%",
}}
contentStyle={{
position: "relative",
width: "100%",
height: "100%",
padding: "8px",
}}
>
<div
className={growClassName}
className={`flex flex-col justify-center items-center ${growClassName}`}
style={{
aspectRatio: aspectRatio,
}}
>
<TransformWrapper minScale={1.0}>
<TransformComponent>
<LivePlayer
key={camera.name}
className={`m-1 ${fullscreen ? "*:rounded-none" : ""}`}
@ -276,12 +288,11 @@ export default function LiveCameraView({ camera }: LiveCameraViewProps) {
micEnabled={mic}
preferredLiveMode={preferredLiveMode}
/>
</TransformComponent>
</TransformWrapper>
</div>
{camera.onvif.host != "" && <PtzControlPanel camera={camera.name} />}
</TransformComponent>
</div>
</div>
</TransformWrapper>
);
}