diff options
author | Markus Hatvan <markus_hatvan@aon.at> | 2021-09-14 11:03:28 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-14 11:03:28 +0200 |
commit | 087113d8a1214ba4c7df03bfe66747d8d944280c (patch) | |
tree | 4d853a03057138dfa845cd6a7d91ccf63565a1a6 /src/electron/windowUtils.ts | |
parent | chore: codebase improvements (#1930) (diff) | |
download | ferdium-app-087113d8a1214ba4c7df03bfe66747d8d944280c.tar.gz ferdium-app-087113d8a1214ba4c7df03bfe66747d8d944280c.tar.zst ferdium-app-087113d8a1214ba4c7df03bfe66747d8d944280c.zip |
chore: convert JS to TS (#1934)
Diffstat (limited to 'src/electron/windowUtils.ts')
-rw-r--r-- | src/electron/windowUtils.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/electron/windowUtils.ts b/src/electron/windowUtils.ts new file mode 100644 index 000000000..1db1ff246 --- /dev/null +++ b/src/electron/windowUtils.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | import { screen } from 'electron'; | ||
2 | |||
3 | export function isPositionValid(position: { x: number; y: number }) { | ||
4 | const displays = screen.getAllDisplays(); | ||
5 | const { x, y } = position; | ||
6 | return displays.some( | ||
7 | ({ workArea }) => | ||
8 | x >= workArea.x && | ||
9 | x <= workArea.x + workArea.width && | ||
10 | y >= workArea.y && | ||
11 | y <= workArea.y + workArea.height, | ||
12 | ); | ||
13 | } | ||