fix(recording): keep live webcam preview visible - #749
Conversation
📝 WalkthroughWalkthroughThe HUD overlay now tracks webcam preview visibility from the renderer through Electron IPC and uses it to determine fallback expansion during recording. The new expansion rule is covered by tests, and preview visibility resets when the HUD window is initialized or the renderer unmounts. ChangesHUD webcam preview visibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant LaunchWindowContent
participant electronAPI
participant preload
participant windows.ts
LaunchWindowContent->>electronAPI: Set webcam preview visibility
electronAPI->>preload: Call hudOverlaySetWebcamPreviewVisible
preload->>windows.ts: Send visibility IPC event
windows.ts->>windows.ts: Recalculate HUD overlay bounds
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
electron/hudOverlayBounds.test.ts (1)
147-178: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a test case for webcam-visible-but-not-recording.
The three cases cover the key branches, but none verify that
webcamPreviewVisible: truealone (withoutrecordingActive) does not trigger expansion. Without this case, someone could change the logic tofallbackExpanded || webcamPreviewVisible(dropping therecordingActive &&guard) and all existing tests would still pass.✅ Suggested additional test case
it("preserves manual fallback expansion outside recording", () => { expect( shouldExpandHudOverlayFallback({ fallbackExpanded: true, recordingActive: false, webcamPreviewVisible: false, }), ).toBe(true); }); + + it("does not expand for webcam preview visibility when not recording", () => { + expect( + shouldExpandHudOverlayFallback({ + fallbackExpanded: false, + recordingActive: false, + webcamPreviewVisible: true, + }), + ).toBe(false); + }); });🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@electron/hudOverlayBounds.test.ts` around lines 147 - 178, Add a test in the shouldExpandHudOverlayFallback suite covering webcamPreviewVisible: true with recordingActive: false and fallbackExpanded: false, and assert that shouldExpandHudOverlayFallback returns false.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@electron/hudOverlayBounds.test.ts`:
- Around line 147-178: Add a test in the shouldExpandHudOverlayFallback suite
covering webcamPreviewVisible: true with recordingActive: false and
fallbackExpanded: false, and assert that shouldExpandHudOverlayFallback returns
false.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 66777852-9727-49b4-9f16-d8608da1be59
📒 Files selected for processing (6)
electron/electron-env.d.tselectron/hudOverlayBounds.test.tselectron/hudOverlayBounds.tselectron/preload.tselectron/windows.tssrc/components/launch/LaunchWindow.tsx
|
@coderabbitai review |
✅ Action performedReview finished.
|
…live-preview-bounds fix(recording): keep live webcam preview visible
…live-preview-bounds fix(recording): keep live webcam preview visible
Summary
Keeps the floating webcam preview fully visible while recording. The fallback HUD expands only when recording and the live webcam preview are both active; webcam-disabled and idle states remain compact.
Root cause and fix
On Windows at 125% scale, recording contracted the HUD to
860x160while the 288x288 preview stayed anchored 120px above the bottom, placing its top at -248px. Capture/editor/export were healthy; the preview was clipped by the compact live HUD viewport.The renderer now reports preview visibility through typed preload IPC. Electron recomputes fallback bounds from recording + preview state and resets visibility with the HUD lifecycle. No webcam encoding, editor/export composition, styling, or persisted placement changes.
Verification
860x540, preview(540,132,288,288), fully inside and not overlapping controls; webcam-off remains860x160and WGC mux completesRisk
The change affects only fallback HUD bounds. Windows x64 was runtime-tested. macOS/Linux, negative-origin multi-monitor layouts, and other scale factors remain reasoned-only.