blob: 3621beb2f891ae51f59e3f07a076ffb2d36fc091 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import { screen } from 'electron';
export default function isPositionValid(position: { x: number; y: number }): boolean {
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,
);
}
|