Add zoom mode functionality and refactor video feed hooks

- Implemented zoom mode in RegionSelector for digital zooming.
- Updated VideoFeedGridPainter to handle zoom interactions.
- Refactored useGetVideoFeed to support target detection and video feed queries based on mode.
- Enhanced useCreateVideoSnapshot to manage snapshots during zoom mode.
This commit is contained in:
2025-12-09 12:39:03 +00:00
parent fa33b012cc
commit c6a336389b
4 changed files with 130 additions and 37 deletions

View File

@@ -5,11 +5,19 @@ import { useCameraFeedContext } from "../../../app/context/CameraFeedContext";
export const useCreateVideoSnapshot = () => {
const { state } = useCameraFeedContext();
const cameraFeedID = state?.cameraFeedID;
const mode = state.modeByCamera[cameraFeedID];
const latestBitmapRef = useRef<ImageBitmap | null>(null);
const { videoQuery } = useGetVideoFeed(cameraFeedID);
const { targetDetectionQuery, videoFeedQuery } = useGetVideoFeed(cameraFeedID, mode);
const snapShot = videoQuery?.data;
const isloading = videoQuery.isPending;
let snapShot = targetDetectionQuery?.data;
const isloading = targetDetectionQuery.isPending;
const videoSnapShot = videoFeedQuery?.data;
const isVideoLoading = videoFeedQuery.isPending;
if (isVideoLoading === false && videoSnapShot && mode === "zoom") {
snapShot = videoSnapShot;
}
useEffect(() => {
async function createBitmap() {