Skip to content

fix: floating webcam preview gets clipped/stuck in HUD passthrough-fallback mode - #17

Merged
Alfredoalv13 merged 1 commit into
mainfrom
fix/webcam-preview-drag-bounds
Jul 24, 2026
Merged

fix: floating webcam preview gets clipped/stuck in HUD passthrough-fallback mode#17
Alfredoalv13 merged 1 commit into
mainfrom
fix/webcam-preview-drag-bounds

Conversation

@Alfredoalv13

Copy link
Copy Markdown
Owner

Summary

  • The floating webcam preview bubble's drag-clamping logic assumed the HUD overlay window always covers the full screen, using `window.screen.width/height` as a fallback bound.
  • That assumption breaks in `getHudOverlayWindowBounds()` (`electron/hudOverlayBounds.ts`): when mouse passthrough isn't supported, the window is deliberately shrunk to a small band anchored to the bottom of the screen (160-540px tall), not full-screen.
  • Result: clamping against the full physical screen size let the preview "move" to positions the small window can't actually render into, so it got visually clipped at the window's real edge - looking stuck in roughly the lower 10% of the screen and unable to be repositioned further, exactly as reported.
  • Fix: clamp against `window.innerWidth`/`window.innerHeight` directly (the window's actual current size), which is correct in both the full-screen and fallback-band cases.

Test plan

  • `tsc --noEmit` clean
  • `npm test` - 94/94 files, 819/819 tests passing
  • Manual: on a system where HUD mouse passthrough falls back (or by forcing the fallback path), enable the webcam and drag the floating preview to confirm it can move freely within the actual HUD window and isn't clipped

The drag-clamping math used Math.max(window.innerWidth, window.screen.width)
(and the height equivalent), on the assumption the HUD overlay window always
covers the full screen. It doesn't: getHudOverlayWindowBounds() in
electron/hudOverlayBounds.ts only sizes it to the full screen when mouse
passthrough is supported. In the non-passthrough fallback mode, the window
is deliberately small - a band anchored to the bottom of the screen - so
clamping against the physical screen size let the preview compute positions
outside what the window can actually render, clipping it at the window's
real edge and making it look stuck a fraction of the way up the screen.

Clamping against window.innerWidth/innerHeight directly keeps the preview
within whatever the window's actual current size is, correct in both modes.
@Alfredoalv13
Alfredoalv13 merged commit b974a78 into main Jul 24, 2026
1 check passed
@Alfredoalv13
Alfredoalv13 deleted the fix/webcam-preview-drag-bounds branch July 24, 2026 20:31
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.

2 participants