From aa4c53905df43e14d0af7a86bad045b10faf9289 Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Tue, 22 Sep 2026 20:19:44 +1000 Subject: [PATCH] Align project captions, fill previews, and protect HUD only during recording --- electron/ipc/register/recording.ts | 3 +- electron/windows.ts | 3 +- src/components/video-editor/VideoPlayback.tsx | 20 +++++++++++-- .../video-editor/dashboard/ProjectCard.tsx | 10 +++---- .../dashboard/ProjectHoverPreview.tsx | 2 ++ .../dashboard/ProjectThumbnail.tsx | 2 +- tests/ui/project-dashboard.spec.ts | 28 ++++++++++++++++++- 7 files changed, 56 insertions(+), 12 deletions(-) diff --git a/electron/ipc/register/recording.ts b/electron/ipc/register/recording.ts index 2c50e397..2262da37 100644 --- a/electron/ipc/register/recording.ts +++ b/electron/ipc/register/recording.ts @@ -404,8 +404,7 @@ export function registerRecordingHandlers( ipcMain.handle( "start-native-screen-recording", async (_, source: SelectedSource, options?: NativeMacRecordingOptions) => { - // Capture starts before the renderer publishes its recording-state - // transition, so protect the HUD at the actual capture boundary. + // Refresh window protection; it applies only while recording is active. reassertHudOverlayCaptureProtection(); const visibleWindowBounds = source.id?.startsWith("window:") ? await bringSelectedWindowForward(source) diff --git a/electron/windows.ts b/electron/windows.ts index 6527d296..fd8eb3f2 100644 --- a/electron/windows.ts +++ b/electron/windows.ts @@ -153,7 +153,8 @@ function applyHudOverlayCaptureProtectionToWindow(hud: BrowserWindow, enabled: b } try { - hud.setContentProtection(enabled); + // Keep the idle HUD visible to screenshots and other capture applications. + hud.setContentProtection(enabled && hudOverlayRecordingActive); } catch (error) { console.warn("Failed to apply HUD capture protection:", error); } diff --git a/src/components/video-editor/VideoPlayback.tsx b/src/components/video-editor/VideoPlayback.tsx index 90a8533a..956581e5 100644 --- a/src/components/video-editor/VideoPlayback.tsx +++ b/src/components/video-editor/VideoPlayback.tsx @@ -29,7 +29,11 @@ import { DEFAULT_WALLPAPER_RELATIVE_PATH, isVideoWallpaperSource, } from "@/lib/wallpapers"; -import { type AspectRatio, formatAspectRatioForCSS } from "@/utils/aspectRatioUtils"; +import { + type AspectRatio, + getAspectRatioValue, + formatAspectRatioForCSS, +} from "@/utils/aspectRatioUtils"; import { AnnotationOverlay } from "./AnnotationOverlay"; import { type CaptionEditTarget, normalizeCaptionEditText } from "./captionEditing"; import { buildActiveCaptionLayout } from "./captionLayout"; @@ -218,6 +222,7 @@ function getEffectiveNativeAspectRatio( interface VideoPlaybackProps { autoPlay?: boolean; + fillPreview?: boolean; clipRegions: ClipRegion[]; videoPath: string; onDurationChange: (duration: number) => void; @@ -305,6 +310,7 @@ const VideoPlayback = forwardRef( { videoPath, autoPlay = false, + fillPreview = false, onDurationChange, onPreviewReadyChange, onTimeUpdate, @@ -2364,7 +2370,17 @@ const VideoPlayback = forwardRef( ref={previewFrameRef} className="relative overflow-hidden" style={{ - width: "100%", + width: fillPreview + ? `max(100cqw, calc(100cqh * ${getAspectRatioValue(aspectRatio, nativeAspectRatio)}))` + : "100%", + ...(fillPreview + ? { + position: "absolute" as const, + left: "50%", + top: "50%", + transform: "translate(-50%, -50%)", + } + : {}), aspectRatio: formatAspectRatioForCSS(aspectRatio, nativeAspectRatio), borderRadius: 0, clipPath: "none", diff --git a/src/components/video-editor/dashboard/ProjectCard.tsx b/src/components/video-editor/dashboard/ProjectCard.tsx index 5ded020d..80ecfa47 100644 --- a/src/components/video-editor/dashboard/ProjectCard.tsx +++ b/src/components/video-editor/dashboard/ProjectCard.tsx @@ -98,9 +98,9 @@ export function ProjectCard({ )} -
- -
+
+ +
{editing ? (
{ @@ -111,7 +111,7 @@ export function ProjectCard({ {entry.name}

diff --git a/src/components/video-editor/dashboard/ProjectHoverPreview.tsx b/src/components/video-editor/dashboard/ProjectHoverPreview.tsx index 07517543..caa6dc30 100644 --- a/src/components/video-editor/dashboard/ProjectHoverPreview.tsx +++ b/src/components/video-editor/dashboard/ProjectHoverPreview.tsx @@ -81,6 +81,7 @@ export function ProjectHoverPreview({ }, [onFinish]); return (