- minor big fixes

- default settings toggled
-update camera zoom need to test
This commit is contained in:
2025-11-04 13:38:06 +00:00
parent 76643cc84c
commit 61894c0c42
9 changed files with 43 additions and 51 deletions

View File

@@ -5,6 +5,7 @@ import { useCameraZoom } from "../../hooks/useCameraZoom";
import { useEffect } from "react";
import Loading from "../UI/Loading";
import ErrorState from "../UI/ErrorState";
import { zoomMapping } from "../../utils/utils";
type SnapshotContainerProps = {
side: string;
@@ -13,20 +14,14 @@ type SnapshotContainerProps = {
onZoomLevelChange?: (level: number) => void;
};
export const SnapshotContainer = ({
side,
settingsPage,
zoomLevel,
onZoomLevelChange,
}: SnapshotContainerProps) => {
export const SnapshotContainer = ({ side, settingsPage, zoomLevel, onZoomLevelChange }: SnapshotContainerProps) => {
const { canvasRef, isError, isPending } = useGetOverviewSnapshot(side);
const cameraControllerSide =
side === "CameraA" ? "CameraControllerA" : "CameraControllerB";
const cameraControllerSide = side === "CameraA" ? "CameraControllerA" : "CameraControllerB";
const { mutation } = useCameraZoom({ camera: cameraControllerSide });
const handleZoomClick = () => {
const baseLevel = zoomLevel ?? 1;
const newLevel = baseLevel >= 8 ? 1 : baseLevel * 2;
const newLevel = baseLevel >= 4 ? 1 : baseLevel * 2;
if (onZoomLevelChange) onZoomLevelChange(newLevel);
@@ -35,9 +30,11 @@ export const SnapshotContainer = ({
useEffect(() => {
if (zoomLevel) {
const text = zoomMapping(zoomLevel);
const zoomInOptions: ZoomInOptions = {
camera: cameraControllerSide,
multiplier: zoomLevel,
multiplierText: text,
};
mutation.mutate(zoomInOptions);
}