mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-26 00:26:05 -07:00
26 lines
585 B
TypeScript
26 lines
585 B
TypeScript
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,
|
|
});
|
|
}
|