Skip to content

fix(hud): keep controls visible when recording starts#750

Merged
meiiie merged 3 commits into
mainfrom
fix/hud-visible-after-recording-start
Jul 11, 2026
Merged

fix(hud): keep controls visible when recording starts#750
meiiie merged 3 commits into
mainfrom
fix/hud-visible-after-recording-start

Conversation

@meiiie

@meiiie meiiie commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fixes a Windows HUD positioning regression where dragging the idle bar before recording could leave the compact recording controls entirely outside the resized viewport.

Root cause and fix

The recording window contracts from the work-area overlay to 860x160, but the renderer retained the prior CSS drag offset. The HUD stayed alive and recording continued; its bar was simply offscreen.

This change adds a small viewport-clamping helper and reapplies the invariant on window/HUD resize. It adjusts only axes that cross the viewport and leaves an already-visible bar unchanged.

Verification

  • Focused viewport tests: 3/3 pass
  • Strict TypeScript and targeted Biome: pass
  • Full Vitest: 103 files, 981 pass, 1 skip
  • Production/native-helper build, Windows NSIS package, and packaged binary smoke: pass
  • Packaged Windows 11 x64: drag idle HUD to top-left, start WGC recording, viewport contracts to 860x160, recording bar remains fully visible at approximately (93.69, 0, 422.52, 69.60), Stop completes mux and opens the editor

Risk

Scope is limited to renderer-side HUD bounds after resize. Capture, recording, audio, export, and editor layout are unchanged. Windows x64 was exercised directly; macOS/Linux behavior is covered by shared geometry tests but was not runtime-tested.

Summary by CodeRabbit

  • Bug Fixes

    • HUD bars now remain fully visible within the viewport when the window is resized or the bar’s dimensions change.
    • Improved positioning prevents HUD bars from extending beyond the right or bottom edges of compact recording windows.
  • Tests

    • Added coverage for HUD positioning when the viewport shrinks and when the bar is already correctly positioned.

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 051cc884-d924-425b-830f-ba8bb0a89f9e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The HUD drag hook now keeps the bar inside the viewport after window or HUD size changes. A reusable clamping utility and Vitest tests define and verify independent horizontal and vertical offset adjustments.

Changes

HUD viewport clamping

Layer / File(s) Summary
HUD offset clamping utility
src/components/launch/hudViewportBounds.ts, src/components/launch/hudViewportBounds.test.ts
Defines HUD offset, bounds, and viewport types; clamps each axis independently and tests compact, visible, and edge-clamping scenarios.
Resize-driven HUD repositioning
src/components/launch/hooks/useHudBarDrag.ts
Recalculates the HUD transform and React offset on window resize or observed HUD element size changes, with cleanup for both listeners.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested labels: Checked

Sequence Diagram(s)

sequenceDiagram
  participant Window
  participant ResizeObserver
  participant useHudBarDrag
  participant HUDBar
  Window->>useHudBarDrag: Emit resize event
  ResizeObserver->>useHudBarDrag: Report HUD size change
  useHudBarDrag->>HUDBar: Read bounding rect
  useHudBarDrag->>useHudBarDrag: Clamp current offset
  useHudBarDrag->>HUDBar: Update transform
  useHudBarDrag->>useHudBarDrag: Update recordingHudOffset
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: keeping HUD controls visible by clamping them within the viewport when recording starts.
Description check ✅ Passed The PR includes summary, motivation/root cause, verification, and risk, covering most required template content despite missing some sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/hud-visible-after-recording-start

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@meiiie

meiiie commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@meiiie meiiie merged commit 157d9a0 into main Jul 11, 2026
4 checks passed
@meiiie meiiie deleted the fix/hud-visible-after-recording-start branch July 11, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant