🐛 Keep camera inspection clear and recover both views
This commit is contained in:
parent
ee3d6b16bf
commit
af7df833b6
@ -18,9 +18,9 @@
|
||||
|
||||
任务 05 将两类字典放入固定编辑区:搜索、每页 2 项、前后页和返回入口固定,长词条显示两行预览,悬停或辅助技术可读取完整词条,填入后可继续完整阅读。F / D 打开,方向键选择,Enter 填入,Esc 一次返回工作台;选择描述模板不会保存,可继续修改。长描述在同一个文本框内滚动,“展开描述编辑”暂时收起精确边界区域以增加文字空间,保存和取消始终在文本滚动区外;收起、切片导航与布局切换不保存草稿。原布局仍使用原有字典弹层。
|
||||
|
||||
任务 06 在专注视图的视频上方提供“放大左相机”“放大右相机”和“恢复双画面”。单路检查期间只改变呈现:两路视频节点和媒体源都保留,隐藏路继续同步;详细切片/描述时间轴临时收成 Capture 进度条,把高度让给所选画面。切片阶段的当前播放头分割入口、播放与逐帧、当前编辑、保存、撤销/重做及阶段提交仍可达。恢复双画面或切回原布局保留播放帧、草稿、选择和历史;原布局继续使用原来的左右相机显示复选框。
|
||||
任务 06 在专注视图的视频上方提供“放大左相机”“放大右相机”和“恢复双画面”。单路检查期间只改变呈现:两路视频节点保留,隐藏路继续同步;详细切片/描述时间轴临时收成画面之外的 Capture 进度条,把其余高度让给所选画面。切片阶段的当前播放头分割入口、播放与逐帧、当前编辑、保存、撤销/重做及阶段提交仍可达。恢复双画面或切回原布局保留播放帧、草稿、选择和历史。原布局继续使用原来的左右相机显示复选框并保留用户的显示选择;进入专注视图时则派生为双路有效可见,必要时由现有媒体传输重新接入被原布局隐藏的源并定位到当前帧,返回原布局后仍恢复原显示选择。
|
||||
|
||||
真实 590×480 双视频在 1280×640 内容区的实测每路有效画面约 410.5×334,单路约 565.4×460;两种模式在五档内容区均随窗口扩大。16:9 与 9:16 的 12 秒、30fps 本地 testsrc2 文件只用于验证左右不同比例时的 `contain` 适配,不代表客户素材或真实工作流覆盖。窗口过小时暂停仍由后续任务交付;当前浏览器尺寸验证不代表已覆盖各种操作系统缩放设置。
|
||||
真实 590×480 双视频在 1280×640 内容区的实测每路有效画面约 410.5×334,单路约 531×432;两种模式在五档内容区均随窗口扩大。16:9 与 9:16 的 12 秒、30fps 本地 testsrc2 文件只用于验证左右不同比例时的 `contain` 适配,不代表客户素材或真实工作流覆盖。窗口过小时暂停仍由后续任务交付;当前浏览器尺寸验证不代表已覆盖各种操作系统缩放设置。
|
||||
|
||||
## 源码恢复与业务数据恢复
|
||||
|
||||
|
||||
@ -314,6 +314,8 @@ export function CaptureAnnotationWorkbench({
|
||||
const [playbackRate, setPlaybackRate] = useState(1);
|
||||
const [showLeft, setShowLeft] = useState(initialCameraVisibility?.left ?? true);
|
||||
const [showRight, setShowRight] = useState(initialCameraVisibility?.right ?? Boolean(rightVideoSource));
|
||||
const effectiveShowLeft = focusedLayout || showLeft;
|
||||
const effectiveShowRight = focusedLayout ? Boolean(rightVideoSource) : showRight;
|
||||
const [inspectionCamera, setInspectionCamera] = useState<"left" | "right" | null>(null);
|
||||
const [selectedBoundary, setSelectedBoundary] = useState<Boundary>(null);
|
||||
const [splitPreview, setSplitPreview] = useState<SplitPreview>(null);
|
||||
@ -630,8 +632,8 @@ export function CaptureAnnotationWorkbench({
|
||||
const transport = useCaptureVideoTransport({
|
||||
leftRef: leftVideoRef,
|
||||
rightRef: rightVideoRef,
|
||||
showLeft,
|
||||
showRight,
|
||||
showLeft: effectiveShowLeft,
|
||||
showRight: effectiveShowRight,
|
||||
leftSource: source,
|
||||
rightSource,
|
||||
enabled: phase !== "materializing",
|
||||
@ -1436,7 +1438,8 @@ export function CaptureAnnotationWorkbench({
|
||||
};
|
||||
|
||||
const selectedSliceStatus = selectedSlice ? statuses[selectedSlice.id] || "pending" : "pending";
|
||||
const videoClass = (focusedLayout && inspectionCamera) || !(showLeft && showRight) ? "grid-cols-1" : "grid-cols-2";
|
||||
const videoClass =
|
||||
(focusedLayout && inspectionCamera) || !(effectiveShowLeft && effectiveShowRight) ? "grid-cols-1" : "grid-cols-2";
|
||||
useEffect(() => {
|
||||
if (editingAnnotation?.id) {
|
||||
descriptionEditorRef.current?.scrollIntoView({ block: "end", behavior: "instant" });
|
||||
@ -1904,7 +1907,7 @@ export function CaptureAnnotationWorkbench({
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={inspectionCamera === "left"}
|
||||
disabled={!showLeft}
|
||||
disabled={!effectiveShowLeft}
|
||||
onClick={() => setInspectionCamera("left")}
|
||||
>
|
||||
放大左相机
|
||||
@ -1913,7 +1916,7 @@ export function CaptureAnnotationWorkbench({
|
||||
<button
|
||||
type="button"
|
||||
aria-pressed={inspectionCamera === "right"}
|
||||
disabled={!showRight}
|
||||
disabled={!effectiveShowRight}
|
||||
onClick={() => setInspectionCamera("right")}
|
||||
>
|
||||
放大右相机
|
||||
@ -1978,30 +1981,30 @@ export function CaptureAnnotationWorkbench({
|
||||
<div className={cn("capture-video-surface grid overflow-hidden rounded-md bg-slate-950", videoClass)}>
|
||||
<video
|
||||
ref={leftVideoRef}
|
||||
src={showLeft ? source : undefined}
|
||||
src={effectiveShowLeft ? source : undefined}
|
||||
data-camera="left"
|
||||
className={cn(
|
||||
"h-[clamp(120px,28dvh,280px)] w-full bg-black object-contain",
|
||||
phase === "annotate" && !mediaOnly && !focusedLayout && "!h-[clamp(100px,24vh,240px)]",
|
||||
mediaOnly && "!h-[clamp(120px,20dvh,200px)]",
|
||||
!showLeft && "hidden",
|
||||
!effectiveShowLeft && "hidden",
|
||||
)}
|
||||
preload={showLeft ? "auto" : "none"}
|
||||
preload={effectiveShowLeft ? "auto" : "none"}
|
||||
playsInline
|
||||
{...transport.mediaEvents("left")}
|
||||
/>
|
||||
{rightSource ? (
|
||||
<video
|
||||
ref={rightVideoRef}
|
||||
src={showRight ? rightSource : undefined}
|
||||
src={effectiveShowRight ? rightSource : undefined}
|
||||
data-camera="right"
|
||||
className={cn(
|
||||
"h-[clamp(120px,28dvh,280px)] w-full bg-black object-contain",
|
||||
phase === "annotate" && !mediaOnly && !focusedLayout && "!h-[clamp(100px,24vh,240px)]",
|
||||
mediaOnly && "!h-[clamp(120px,20dvh,200px)]",
|
||||
!showRight && "hidden",
|
||||
!effectiveShowRight && "hidden",
|
||||
)}
|
||||
preload={showRight ? "auto" : "none"}
|
||||
preload={effectiveShowRight ? "auto" : "none"}
|
||||
muted
|
||||
playsInline
|
||||
{...transport.mediaEvents("right")}
|
||||
|
||||
@ -1193,6 +1193,10 @@
|
||||
.capture-workbench[data-camera-inspection]
|
||||
[data-testid="capture-video-panel"] {
|
||||
grid-row: 1 / 4;
|
||||
grid-template-rows: 22px minmax(0, 1fr) 28px 64px;
|
||||
}
|
||||
.annotation-operations-page[data-workspace-compact] .capture-workbench[data-camera-inspection] .capture-media-controls {
|
||||
grid-row: 4;
|
||||
}
|
||||
.annotation-operations-page[data-workspace-compact]
|
||||
.capture-workbench[data-camera-inspection]
|
||||
|
||||
@ -130,13 +130,76 @@ try {
|
||||
}
|
||||
|
||||
await workbench.focus();
|
||||
await page.keyboard.press("ArrowRight");
|
||||
for (let index = 0; index < 6; index++) await page.keyboard.press("ArrowRight");
|
||||
const heldFrame = await frameNumber();
|
||||
const detailedSliceTimeline = page.getByTestId("capture-slice-timeline");
|
||||
const detailedDescriptionTimeline = page.getByTestId("slice-annotation-timeline");
|
||||
assert.ok(await visible(detailedSliceTimeline), "dual-camera mode shows the detailed slice timeline");
|
||||
assert.ok(await visible(detailedDescriptionTimeline), "dual-camera mode shows the detailed description timeline");
|
||||
|
||||
const reviewFailures = [];
|
||||
await button("放大左相机").click();
|
||||
const selectedVideoBox = await videos.first().boundingBox();
|
||||
const reviewProgressBox = await page.locator(".capture-timeline-editor").boundingBox();
|
||||
assert.ok(selectedVideoBox && reviewProgressBox);
|
||||
const coveredPicturePixels = selectedVideoBox.y + selectedVideoBox.height - reviewProgressBox.y;
|
||||
if (coveredPicturePixels > 0.5)
|
||||
reviewFailures.push(`inspection progress covers ${coveredPicturePixels}px of the selected video box`);
|
||||
await page.screenshot({
|
||||
path: "local-data/verification/annotation-workspace-layout/task06-review-progress-overlap.png",
|
||||
});
|
||||
await button("恢复双画面").click();
|
||||
|
||||
for (const camera of ["left", "right"]) {
|
||||
const cameraLabel = camera === "left" ? "左相机" : "右相机";
|
||||
const inspectLabel = camera === "left" ? "放大左相机" : "放大右相机";
|
||||
await button("切回原布局").click();
|
||||
const checkbox = page.getByRole("checkbox", { name: cameraLabel, exact: true });
|
||||
await checkbox.uncheck();
|
||||
assert.equal(await checkbox.isChecked(), false, `original ${camera} preference is hidden`);
|
||||
await button("进入专注视图").click();
|
||||
await page.waitForTimeout(1200);
|
||||
const restored = await page.locator(`video[data-camera="${camera}"]`).evaluate((video) => {
|
||||
const rect = video.getBoundingClientRect();
|
||||
return {
|
||||
hasSource: Boolean(video.getAttribute("src")),
|
||||
visible: rect.width > 0 && rect.height > 0 && getComputedStyle(video).visibility !== "hidden",
|
||||
ready: video.readyState >= 2,
|
||||
currentTime: video.currentTime,
|
||||
};
|
||||
});
|
||||
const otherTime = await page
|
||||
.locator(`video[data-camera="${camera === "left" ? "right" : "left"}"]`)
|
||||
.evaluate((video) => video.currentTime);
|
||||
const restoredFrame = await frameNumber();
|
||||
if (
|
||||
!restored.hasSource ||
|
||||
!restored.visible ||
|
||||
!restored.ready ||
|
||||
Math.abs(restored.currentTime - otherTime) >= 0.05 ||
|
||||
restoredFrame !== heldFrame ||
|
||||
(await button(inspectLabel).isDisabled())
|
||||
)
|
||||
reviewFailures.push(
|
||||
`focused ${camera} recovery failed: ${JSON.stringify({ ...restored, otherTime, heldFrame, restoredFrame })}`,
|
||||
);
|
||||
for (const handle of videoHandles) assert.ok(await handle.evaluate((element) => element.isConnected));
|
||||
if (draftInput) assert.equal(await draftInput.inputValue(), draft, `${camera} recovery retains the active draft`);
|
||||
await page.screenshot({
|
||||
path: `local-data/verification/annotation-workspace-layout/task06-review-${camera}-recovery.png`,
|
||||
});
|
||||
await button("切回原布局").click();
|
||||
assert.equal(await checkbox.isChecked(), false, `focused ${camera} recovery preserves original preference`);
|
||||
await checkbox.check();
|
||||
await button("进入专注视图").click();
|
||||
await page.waitForTimeout(1200);
|
||||
}
|
||||
console.log(
|
||||
"Task06 review reproduction",
|
||||
JSON.stringify({ coveredPicturePixels, heldFrame, failures: reviewFailures }),
|
||||
);
|
||||
assert.deepEqual(reviewFailures, [], "inspection leaves the full picture visible and restores hidden cameras");
|
||||
|
||||
let previousDualWidth = 0;
|
||||
let previousSingleWidth = 0;
|
||||
for (const [width, height] of [
|
||||
@ -149,6 +212,10 @@ try {
|
||||
await page.setViewportSize({ width, height });
|
||||
await button("恢复双画面").waitFor();
|
||||
const dual = await effectivePictures();
|
||||
if (width === 1280)
|
||||
await page.screenshot({
|
||||
path: "local-data/verification/annotation-workspace-layout/task06-minimum-dual.png",
|
||||
});
|
||||
assert.deepEqual(
|
||||
dual.map((picture) => picture.intrinsic),
|
||||
[
|
||||
@ -167,6 +234,10 @@ try {
|
||||
await button("放大左相机").click();
|
||||
await page.locator('[data-camera-inspection="left"]').waitFor();
|
||||
const single = await effectivePictures();
|
||||
if (width === 1280)
|
||||
await page.screenshot({
|
||||
path: "local-data/verification/annotation-workspace-layout/task06-minimum-left-inspection.png",
|
||||
});
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
viewport: [width, height],
|
||||
@ -218,6 +289,9 @@ try {
|
||||
await page.setViewportSize({ width: 1280, height: 640 });
|
||||
await button("放大右相机").click();
|
||||
const rightSingle = await effectivePictures();
|
||||
await page.screenshot({
|
||||
path: "local-data/verification/annotation-workspace-layout/task06-minimum-right-inspection.png",
|
||||
});
|
||||
assert.ok(rightSingle[1].width >= 490 && rightSingle[1].height >= 398, "right-camera inspection also grows");
|
||||
assert.ok(
|
||||
Math.abs(rightSingle[0].currentTime - rightSingle[1].currentTime) < 0.05,
|
||||
|
||||
@ -66,8 +66,10 @@ test("both playhead sliders use latest-only pointer previews and exact final com
|
||||
});
|
||||
|
||||
test("hidden sources detach and right-only playback maps back to the canonical frame clock", () => {
|
||||
assert.match(workbench, /src=\{showLeft \? source : undefined\}/);
|
||||
assert.match(workbench, /src=\{showRight \? rightSource : undefined\}/);
|
||||
assert.match(workbench, /const effectiveShowLeft = focusedLayout \|\| showLeft/);
|
||||
assert.match(workbench, /const effectiveShowRight = focusedLayout \? Boolean\(rightVideoSource\) : showRight/);
|
||||
assert.match(workbench, /src=\{effectiveShowLeft \? source : undefined\}/);
|
||||
assert.match(workbench, /src=\{effectiveShowRight \? rightSource : undefined\}/);
|
||||
assert.match(workbench, /mapCameraBoundaryTime\(rightMediaBoundaries, frameBoundaries, time\)/);
|
||||
assert.match(transport, /return c\.showLeft \? c\.leftRef\.current : c\.rightRef\.current/);
|
||||
assert.match(transport, /video\.load\(\)/);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user