Fixed isInsideRectangle to actually work, and removed null check for matchingScreen since it will always return something (#3093)

This commit is contained in:
Devin Binnie
2024-07-16 09:35:06 -04:00
committed by GitHub
parent 35665dee33
commit 2dee9b6bc8
3 changed files with 34 additions and 3 deletions

View File

@@ -18,7 +18,23 @@ import Utils from 'common/utils/util';
import type {Args} from 'types/args';
export function isInsideRectangle(container: Electron.Rectangle, rect: Electron.Rectangle) {
return container.x <= rect.x && container.y <= rect.y && container.width >= rect.width && container.height >= rect.height;
if (container.x > rect.x) {
return false;
}
if (container.x + container.width < rect.x + rect.width) {
return false;
}
if (container.y > rect.y) {
return false;
}
if (container.y + container.height < rect.y + rect.height) {
return false;
}
return true;
}
export function shouldBeHiddenOnStartup(parsedArgv: Args) {