Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(overlay): stop the HUD drag from drifting away from the cursor
Etienne Lescot348a8ef25af4
diff --git a/src/components/launch/LaunchWindow.tsx b/src/components/launch/LaunchWindow.tsxindex 1136d8537..723660a39 100644--- a/src/components/launch/LaunchWindow.tsx+++ b/src/components/launch/LaunchWindow.tsx@@ -321,9 +321,16 @@ export function LaunchWindow() {// and scrolls. Measure from the window's bottom-centre (the anchor the main process// preserves) so fixed bottom/centre offsets keep this stable and it doesn't oscillate.const lastHudSizeRef = useRef({ width: 0, height: 0 });+ const isDraggingHudRef = useRef(false);const measureHudSize = useCallback(() => {const barEl = hudBarRef.current;if (!barEl || !window.electronAPI?.setHudOverlaySize) return;+ // While the user is dragging the HUD, ignore content-size measurements. A+ // ResizeObserver-driven resize (hud-overlay-set-size) re-centres the window from+ // its own bottom-centre anchor, which fights the position "hud-overlay-move-by" is+ // actively applying frame-by-frame -- the two IPC channels racing is what produces+ // the reported drift. Content size is re-measured once the drag ends instead.+ if (isDraggingHudRef.current) return;// Breathing room so the drop shadow isn't clipped. TOP_MARGIN must also exceed the// slack in the bar's `max-h: calc(100vh - 2.5rem)` cap (40px reserved - 20px bottom@@ -634,6 +641,7 @@ export function LaunchWindow() {setHudMouseEventsEnabled(true);event.currentTarget.setPointerCapture(event.pointerId);dragLastPositionRef.current = { x: event.screenX, y: event.screenY };+ isDraggingHudRef.current = true;};const handleHudDragPointerMove = (event: React.PointerEvent<HTMLDivElement>) => {const lastPosition = dragLastPositionRef.current;@@ -650,6 +658,8 @@ export function LaunchWindow() {event.currentTarget.releasePointerCapture(event.pointerId);}setHudMouseEventsEnabled(false);+ isDraggingHudRef.current = false;+ measureHudSize();};return (