frontend and i18n

This commit is contained in:
Josh Hawkins 2025-06-25 16:05:14 -05:00
parent 685a9f7ce3
commit 950f587f0d
3 changed files with 54 additions and 3 deletions

View File

@ -38,6 +38,14 @@
"label": "Zoom PTZ camera out"
}
},
"focus": {
"in": {
"label": "Focus PTZ camera in"
},
"out": {
"label": "Focus PTZ camera out"
}
},
"frame": {
"center": {
"label": "Click in the frame to center the PTZ camera"

View File

@ -1,4 +1,11 @@
type PtzFeature = "pt" | "zoom" | "pt-r" | "zoom-r" | "zoom-a" | "pt-r-fov";
type PtzFeature =
| "pt"
| "zoom"
| "pt-r"
| "zoom-r"
| "zoom-a"
| "pt-r-fov"
| "focus";
export type CameraPtzInfo = {
name: string;

View File

@ -92,6 +92,8 @@ import {
LuX,
} from "react-icons/lu";
import {
MdCenterFocusStrong,
MdCenterFocusWeak,
MdClosedCaption,
MdClosedCaptionDisabled,
MdNoPhotography,
@ -808,10 +810,10 @@ function PtzControlPanel({
sendPtz("MOVE_DOWN");
break;
case "+":
sendPtz("ZOOM_IN");
sendPtz(modifiers.shift ? "FOCUS_IN" : "ZOOM_IN");
break;
case "-":
sendPtz("ZOOM_OUT");
sendPtz(modifiers.shift ? "FOCUS_OUT" : "ZOOM_OUT");
break;
}
},
@ -922,6 +924,40 @@ function PtzControlPanel({
</TooltipButton>
</>
)}
{ptz?.features?.includes("focus") && (
<>
<TooltipButton
label={t("ptz.focus.in.label")}
onMouseDown={(e) => {
e.preventDefault();
sendPtz("FOCUS_IN");
}}
onTouchStart={(e) => {
e.preventDefault();
sendPtz("FOCUS_IN");
}}
onMouseUp={onStop}
onTouchEnd={onStop}
>
<MdCenterFocusStrong />
</TooltipButton>
<TooltipButton
label={t("ptz.focus.out.label")}
onMouseDown={(e) => {
e.preventDefault();
sendPtz("FOCUS_OUT");
}}
onTouchStart={(e) => {
e.preventDefault();
sendPtz("FOCUS_OUT");
}}
onMouseUp={onStop}
onTouchEnd={onStop}
>
<MdCenterFocusWeak />
</TooltipButton>
</>
)}
{ptz?.features?.includes("pt-r-fov") && (
<TooltipProvider>