Create polished demo videos without editing skills. Mac/Windows/Linux
fix(hud-overlay): keep drag bounds size fixed to prevent cursor drift on Windows
TARO-gh401d9a6d7220
diff --git a/electron/windows.ts b/electron/windows.tsindex 056541cb..d3f64897 100644--- a/electron/windows.ts+++ b/electron/windows.ts@@ -184,6 +184,7 @@ ipcMain.on("hud-overlay-set-ignore-mouse", (_event, ignore: boolean) => {let hudDragOffset: { x: number; y: number } | null = null;let hudDragLastCursor: { x: number; y: number } | null = null;+let hudDragFixedSize: { width: number; height: number } | null = null;ipcMain.on("hud-overlay-drag", (_event, phase: string, screenX: number, screenY: number) => {if (!hudOverlayWindow || hudOverlayWindow.isDestroyed()) return;@@ -192,19 +193,30 @@ ipcMain.on("hud-overlay-drag", (_event, phase: string, screenX: number, screenY:const bounds = hudOverlayWindow.getBounds();hudDragOffset = { x: screenX - bounds.x, y: screenY - bounds.y };hudDragLastCursor = { x: screenX, y: screenY };+ hudDragFixedSize = { width: bounds.width, height: bounds.height };} else if (phase === "move" && hudDragOffset) {if (hudDragLastCursor && hudDragLastCursor.x === screenX && hudDragLastCursor.y === screenY) {return;}hudDragLastCursor = { x: screenX, y: screenY };- hudOverlayWindow.setPosition(- Math.round(screenX - hudDragOffset.x),- Math.round(screenY - hudDragOffset.y),+ const targetX = Math.round(screenX - hudDragOffset.x);+ const targetY = Math.round(screenY - hudDragOffset.y);+ const fixedWidth = hudDragFixedSize?.width ?? hudOverlayWindow.getBounds().width;+ const fixedHeight = hudDragFixedSize?.height ?? hudOverlayWindow.getBounds().height;+ hudOverlayWindow.setBounds(+ {+ x: targetX,+ y: targetY,+ width: fixedWidth,+ height: fixedHeight,+ },+ false,);} else if (phase === "end") {hudDragOffset = null;hudDragLastCursor = null;+ hudDragFixedSize = null;}});