update ignore
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<script lang="ts">
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import { flip } from "svelte/animate";
|
||||
import { cubicIn, cubicOut } from "svelte/easing";
|
||||
@@ -59,6 +59,9 @@
|
||||
export let replayFrameInfo = "";
|
||||
export let showPrecisionTestPanel = false;
|
||||
export let showCalibrationPanel = false;
|
||||
export let isCalibrationRunning = false;
|
||||
export let calibrationDefaultFramesPerRound = 10;
|
||||
export let calibrationDefaultRoundIntervalSeconds = 300;
|
||||
|
||||
type CalibrationMethodId = "coarse";
|
||||
|
||||
@@ -82,6 +85,12 @@
|
||||
let calibrationRoundsByMethod: Record<CalibrationMethodId, number> = {
|
||||
coarse: 3,
|
||||
};
|
||||
let calibrationFramesByMethod: Record<CalibrationMethodId, number> = {
|
||||
coarse: calibrationDefaultFramesPerRound,
|
||||
};
|
||||
let calibrationIntervalsByMethod: Record<CalibrationMethodId, number> = {
|
||||
coarse: calibrationDefaultRoundIntervalSeconds,
|
||||
};
|
||||
|
||||
const minRailScale = 0.2;
|
||||
const dispatch = createEventDispatcher<{
|
||||
@@ -90,6 +99,8 @@
|
||||
calibrationstart: {
|
||||
methodId: CalibrationMethodId;
|
||||
rounds: number;
|
||||
framesPerRound: number;
|
||||
roundIntervalSeconds: number;
|
||||
};
|
||||
replaytoggle: void;
|
||||
replaystop: void;
|
||||
@@ -111,22 +122,25 @@
|
||||
locale === "zh-CN" ? "实时压力数据 / 数字矩阵" : "Live pressure matrix";
|
||||
$: calibrationMethodLabel = locale === "zh-CN" ? "标定方法" : "Calibration Method";
|
||||
$: calibrationRoundsLabel = locale === "zh-CN" ? "期望标定轮次" : "Target Rounds";
|
||||
$: calibrationStartLabel = locale === "zh-CN" ? "启动标定" : "Start Calibration";
|
||||
$: calibrationFramesLabel = locale === "zh-CN" ? "每轮帧数" : "Frames Per Round";
|
||||
$: calibrationIntervalLabel = locale === "zh-CN" ? "轮间间隔(秒)" : "Round Interval (s)";
|
||||
$: calibrationStartLabel = isCalibrationRunning
|
||||
? locale === "zh-CN" ? "结束标定" : "Stop Calibration"
|
||||
: locale === "zh-CN" ? "启动标定" : "Start Calibration";
|
||||
$: calibrationPanelHint =
|
||||
locale === "zh-CN"
|
||||
? "先选择标定方法并设置轮次,再启动标定。"
|
||||
: "Select a calibration method, set target rounds, then start.";
|
||||
? "先设置轮次、每轮帧数和轮间间隔,再启动粗标定。运行中可直接结束。"
|
||||
: "Set rounds, frames per round, and interval before starting. While running, the button stops calibration.";
|
||||
$: calibrationMethodOptions = [
|
||||
{
|
||||
id: "coarse",
|
||||
label: locale === "zh-CN" ? "粗标定" : "Coarse Calibration",
|
||||
description:
|
||||
locale === "zh-CN"
|
||||
? "快速分轮采样,适合初步校准。"
|
||||
: "Fast multi-round sampling for initial calibration.",
|
||||
? "适合初始标定,可按轮次连续采样并自动等待下一轮。"
|
||||
: "Fast multi-round sampling for initial calibration with automatic waits between rounds.",
|
||||
},
|
||||
] satisfies CalibrationMethodOption[];
|
||||
|
||||
function toPxNumber(rawValue: string): number {
|
||||
const value = Number.parseFloat(rawValue);
|
||||
return Number.isFinite(value) ? value : 0;
|
||||
@@ -210,10 +224,32 @@
|
||||
return clamp(safeValue, 1, 20);
|
||||
}
|
||||
|
||||
function normalizeCalibrationFrames(value: number): number {
|
||||
const safeValue = Number.isFinite(value)
|
||||
? Math.round(value)
|
||||
: calibrationDefaultFramesPerRound;
|
||||
return clamp(safeValue, 1, 10000);
|
||||
}
|
||||
|
||||
function normalizeCalibrationInterval(value: number): number {
|
||||
const safeValue = Number.isFinite(value)
|
||||
? Math.round(value)
|
||||
: calibrationDefaultRoundIntervalSeconds;
|
||||
return clamp(safeValue, 0, 3600);
|
||||
}
|
||||
|
||||
function calibrationRounds(methodId: CalibrationMethodId): number {
|
||||
return calibrationRoundsByMethod[methodId] ?? 1;
|
||||
}
|
||||
|
||||
function calibrationFrames(methodId: CalibrationMethodId): number {
|
||||
return calibrationFramesByMethod[methodId] ?? calibrationDefaultFramesPerRound;
|
||||
}
|
||||
|
||||
function calibrationInterval(methodId: CalibrationMethodId): number {
|
||||
return calibrationIntervalsByMethod[methodId] ?? calibrationDefaultRoundIntervalSeconds;
|
||||
}
|
||||
|
||||
function handleCalibrationRoundsInput(
|
||||
event: Event,
|
||||
methodId: CalibrationMethodId,
|
||||
@@ -226,16 +262,52 @@
|
||||
};
|
||||
}
|
||||
|
||||
function handleCalibrationFramesInput(
|
||||
event: Event,
|
||||
methodId: CalibrationMethodId,
|
||||
): void {
|
||||
const target = event.currentTarget as HTMLInputElement;
|
||||
const nextValue = Number(target.value);
|
||||
calibrationFramesByMethod = {
|
||||
...calibrationFramesByMethod,
|
||||
[methodId]: normalizeCalibrationFrames(nextValue),
|
||||
};
|
||||
}
|
||||
|
||||
function handleCalibrationIntervalInput(
|
||||
event: Event,
|
||||
methodId: CalibrationMethodId,
|
||||
): void {
|
||||
const target = event.currentTarget as HTMLInputElement;
|
||||
const nextValue = Number(target.value);
|
||||
calibrationIntervalsByMethod = {
|
||||
...calibrationIntervalsByMethod,
|
||||
[methodId]: normalizeCalibrationInterval(nextValue),
|
||||
};
|
||||
}
|
||||
|
||||
function emitCalibrationStart(methodId: CalibrationMethodId): void {
|
||||
const rounds = normalizeCalibrationRounds(calibrationRounds(methodId));
|
||||
const framesPerRound = normalizeCalibrationFrames(calibrationFrames(methodId));
|
||||
const roundIntervalSeconds = normalizeCalibrationInterval(calibrationInterval(methodId));
|
||||
calibrationRoundsByMethod = {
|
||||
...calibrationRoundsByMethod,
|
||||
[methodId]: rounds,
|
||||
};
|
||||
calibrationFramesByMethod = {
|
||||
...calibrationFramesByMethod,
|
||||
[methodId]: framesPerRound,
|
||||
};
|
||||
calibrationIntervalsByMethod = {
|
||||
...calibrationIntervalsByMethod,
|
||||
[methodId]: roundIntervalSeconds,
|
||||
};
|
||||
|
||||
dispatch("calibrationstart", {
|
||||
methodId,
|
||||
rounds,
|
||||
framesPerRound,
|
||||
roundIntervalSeconds,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -350,7 +422,7 @@
|
||||
<section class="split-panel split-calibration-panel">
|
||||
<header class="split-panel-head is-interactive">
|
||||
<div class="split-panel-title">
|
||||
<p>{locale === "zh-CN" ? "校准控制" : "Calibration Control"}</p>
|
||||
<p>{locale === "zh-CN" ? "标定控制" : "Calibration Control"}</p>
|
||||
<span>{calibrationPanelHint}</span>
|
||||
</div>
|
||||
<button
|
||||
@@ -387,6 +459,7 @@
|
||||
min="1"
|
||||
max="20"
|
||||
value={calibrationRounds(method.id)}
|
||||
disabled={isCalibrationRunning}
|
||||
on:change={(event) =>
|
||||
handleCalibrationRoundsInput(event, method.id)}
|
||||
on:input={(event) =>
|
||||
@@ -394,6 +467,51 @@
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="calibration-param-group">
|
||||
<label
|
||||
class="calibration-label"
|
||||
for={`calibration-frames-${method.id}`}
|
||||
>
|
||||
{calibrationFramesLabel}
|
||||
</label>
|
||||
<input
|
||||
id={`calibration-frames-${method.id}`}
|
||||
class="calibration-input"
|
||||
type="number"
|
||||
min="1"
|
||||
max="10000"
|
||||
value={calibrationFrames(method.id)}
|
||||
disabled={isCalibrationRunning}
|
||||
on:change={(event) =>
|
||||
handleCalibrationFramesInput(event, method.id)}
|
||||
on:input={(event) =>
|
||||
handleCalibrationFramesInput(event, method.id)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="calibration-param-group">
|
||||
<label
|
||||
class="calibration-label"
|
||||
for={`calibration-interval-${method.id}`}
|
||||
>
|
||||
{calibrationIntervalLabel}
|
||||
</label>
|
||||
<input
|
||||
id={`calibration-interval-${method.id}`}
|
||||
class="calibration-input"
|
||||
type="number"
|
||||
min="0"
|
||||
max="3600"
|
||||
step="1"
|
||||
value={calibrationInterval(method.id)}
|
||||
disabled={isCalibrationRunning}
|
||||
on:change={(event) =>
|
||||
handleCalibrationIntervalInput(event, method.id)}
|
||||
on:input={(event) =>
|
||||
handleCalibrationIntervalInput(event, method.id)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="calibration-button"
|
||||
@@ -815,6 +933,7 @@
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
padding: 2.1rem 0.2rem 0.2rem;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.calibration-content {
|
||||
@@ -846,6 +965,7 @@
|
||||
}
|
||||
|
||||
.calibration-button {
|
||||
inline-size: 100%;
|
||||
min-inline-size: 8.3rem;
|
||||
min-block-size: 2.45rem;
|
||||
padding: 0.625rem 1rem;
|
||||
@@ -879,8 +999,8 @@
|
||||
|
||||
.calibration-method-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) minmax(7.6rem, 9.2rem) auto;
|
||||
align-items: end;
|
||||
grid-template-columns: repeat(4, minmax(0, 1fr));
|
||||
align-items: start;
|
||||
gap: 0.62rem;
|
||||
padding: 0.64rem 0.66rem;
|
||||
background: rgb(var(--hud-surface-rgb) / 0.56);
|
||||
@@ -895,6 +1015,7 @@
|
||||
}
|
||||
|
||||
.calibration-method-main {
|
||||
grid-column: 1 / -1;
|
||||
min-inline-size: 0;
|
||||
}
|
||||
|
||||
@@ -915,6 +1036,7 @@
|
||||
.calibration-param-group {
|
||||
display: grid;
|
||||
gap: 0.32rem;
|
||||
min-inline-size: 0;
|
||||
}
|
||||
|
||||
.split-panel {
|
||||
@@ -945,9 +1067,9 @@
|
||||
.split-panel-head.is-interactive {
|
||||
left: 0.52rem;
|
||||
right: 0.52rem;
|
||||
display: flex;
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 0.6rem;
|
||||
pointer-events: auto;
|
||||
}
|
||||
@@ -955,7 +1077,8 @@
|
||||
.split-panel-title {
|
||||
display: grid;
|
||||
gap: 0.1rem;
|
||||
min-width: 0;
|
||||
min-inline-size: 0;
|
||||
max-inline-size: 100%;
|
||||
}
|
||||
|
||||
.split-close-btn {
|
||||
@@ -997,6 +1120,20 @@
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.split-calibration-panel .split-panel-head p {
|
||||
font-size: 0.78rem;
|
||||
line-height: 1.2;
|
||||
letter-spacing: 0.08em;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.split-calibration-panel .split-panel-head span {
|
||||
font-size: 0.7rem;
|
||||
line-height: 1.4;
|
||||
letter-spacing: 0.02em;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.split-panel-body {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
@@ -1301,6 +1438,10 @@
|
||||
.split-calibration-wrap {
|
||||
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.calibration-method-row {
|
||||
grid-template-columns: repeat(2, minmax(0, 1fr));
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-height: 900px) {
|
||||
@@ -1369,3 +1510,4 @@
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user