mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-26 00:26:05 -07:00
Fix Windows overlay scaling bounds (#34)
This commit is contained in:
25
src/core/services/overlay-window-bounds.ts
Normal file
25
src/core/services/overlay-window-bounds.ts
Normal 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,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user