Fix Windows overlay scaling bounds (#34)

This commit is contained in:
2026-03-25 16:30:11 -07:00
committed by GitHub
parent 842008b089
commit 5ee4617607
4 changed files with 68 additions and 7 deletions

View File

@@ -0,0 +1,25 @@
import type { WindowGeometry } from '../../types';
type ScreenDipConverter = {
screenToDipRect: (
window: Electron.BrowserWindow | null,
rect: Electron.Rectangle,
) => Electron.Rectangle;
};
export function normalizeOverlayWindowBoundsForPlatform(
geometry: WindowGeometry,
platform: NodeJS.Platform,
screen: ScreenDipConverter | null,
): WindowGeometry {
if (platform !== 'win32' || !screen) {
return geometry;
}
return screen.screenToDipRect(null, {
x: geometry.x,
y: geometry.y,
width: geometry.width,
height: geometry.height,
});
}