blob: 1db1ff246411a4fa8cbbe600585be708683107bc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { screen } from 'electron';
export function isPositionValid(position: { x: number; y: number }) {
const displays = screen.getAllDisplays();
const { x, y } = position;
return displays.some(
({ workArea }) =>
x >= workArea.x &&
x <= workArea.x + workArea.width &&
y >= workArea.y &&
y <= workArea.y + workArea.height,
);
}
|