feat(client): 同步每路镜像并精简操控入口与 HUD 映射
构建客户端 / 检查(类型 + 单元测试) (push) Canceled after 0s
构建客户端 / Linux x64(deb + AppImage) (push) Canceled after 0s
构建客户端 / Windows x64(NSIS 安装包) (push) Canceled after 0s
构建客户端 / macOS 通用(.app + .dmg) (push) Canceled after 0s

This commit is contained in:
sloray committed 2026-11-01 23:38:10 +08:00
1 parent 38410bacd4
commit 1b1fa0f35b
28 files changed
+503 -62

No files matched your search

+21
View File
@@ -0,0 +1,21 @@
import { useEffect, useState, type RefObject, type CSSProperties } from "react";
import { neutralAxes, type OperatorAxes } from "../lib/operator-input";
/** 显示已提交的客户端通道值;不把它描述为串口回执或真实机构速度。 */
export function OperatorMapping({ source, synthetic }: { source: RefObject<OperatorAxes>; synthetic: boolean }) {
const [axes, setAxes] = useState(neutralAxes);
useEffect(() => {
const timer = window.setInterval(() => setAxes({ ...source.current }), 40);
return () => window.clearInterval(timer);
}, [source]);
const channels = [["CH0", "W / S", "前后", axes.forward], ["CH1", "A / D", "左右", axes.strafe], ["CH2", "MOUSE X", "水平", axes.yaw], ["CH3", "MOUSE Y", "俯仰", axes.pitch]] as const;
return <div className="operator-mapping" aria-label="调试协议映射">
<header><span>CONTROL / MAPPING</span><b>{synthetic ? "合成输入" : "客户端输入"}</b></header>
<div className="operator-mapping__flow"><span>键鼠</span><i>→</i><span>UDP</span><i>→</i><span>C3 / UART</span></div>
<div className="operator-mapping__channels">{channels.map(([id, input, label, value]) => <div className="operator-mapping__channel" key={id}>
<span>{input}</span><span>{id} / {label}</span><strong className="num">{value > 0 ? "+" : ""}{value}</strong>
<div className="operator-mapping__track"><i style={{left: `${50 + Math.min(0, value / 20)}%`, width: `${Math.abs(value) / 20}%`} as CSSProperties} /><b /></div>
</div>)}</div>
<footer><span className={axes.fire ? "is-firing" : ""}>LMB → FIRE <b>{Number(axes.fire)}</b></span><span>±1000 · 速度比例</span><span>ESC 退出</span></footer>
</div>;
}