From b7da508ccc1f3371b79ab1406f0cf34329b8d37b Mon Sep 17 00:00:00 2001 From: Sebastian Stenzel Date: Mon, 18 Sep 2023 13:19:58 +0200 Subject: [PATCH] Update src/main/java/org/cryptomator/ui/mainwindow/ResizeController.java Co-authored-by: Bas Ruigrok --- .../ui/mainwindow/ResizeController.java | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/mainwindow/ResizeController.java b/src/main/java/org/cryptomator/ui/mainwindow/ResizeController.java index 76bddd0d8..2bd387ab0 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/ResizeController.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/ResizeController.java @@ -90,17 +90,17 @@ public class ResizeController implements FxController { } private boolean isOutOfDisplayBounds() { - final int x = settings.windowXPosition.get(); - final int y = settings.windowYPosition.get(); - final int width = settings.windowWidth.get(); - final int height = settings.windowHeight.get(); - return isRectangleOutOfScreen(x + 20, y, 0, height) // Left pixel column (+20) - || isRectangleOutOfScreen(x + width - 20, y, 0, height) // Right pixel column (-20) - || isRectangleOutOfScreen(x, y + 5, width, 0) // Top pixel row (+5) - || isRectangleOutOfScreen(x, y + height - 20, width, 0); // Bottom pixel row (-20) + final double x = window.getX() + 20; + final double y = window.getY() + 5; + final double width = window.getWidth() - 40; // Window width - inset right (20px) - inset left (20px) + final double height = window.getHeight() - 25; // Window height - inset top (5px) - inset bottom (20px) + return isRectangleOutOfScreen(x, y, 0, height) // Left pixel column (+20) + || isRectangleOutOfScreen(x + width, y, 0, height) // Right pixel column (-20) + || isRectangleOutOfScreen(x, y, width, 0) // Top pixel row (+5) + || isRectangleOutOfScreen(x, y + height, width, 0); // Bottom pixel row (-20) } - private boolean isRectangleOutOfScreen(int x, int y, int width, int height) { + private boolean isRectangleOutOfScreen(double x, double y, double width, double height) { return Screen.getScreensForRectangle(x, y, width, height).isEmpty(); }