From 58d65c609f792f7edba8930cd90464ffad274e41 Mon Sep 17 00:00:00 2001 From: Martin Beyer Date: Tue, 24 Aug 2021 17:38:01 +0200 Subject: [PATCH] set the position on illegal position --- .../ui/mainwindow/ResizeController.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/cryptomator/ui/mainwindow/ResizeController.java b/src/main/java/org/cryptomator/ui/mainwindow/ResizeController.java index 9f8204706..95138ea97 100644 --- a/src/main/java/org/cryptomator/ui/mainwindow/ResizeController.java +++ b/src/main/java/org/cryptomator/ui/mainwindow/ResizeController.java @@ -45,14 +45,26 @@ public class ResizeController implements FxController { blResizer.setOnMouseDragged(this::resizeBottomLeft); brResizer.setOnMouseDragged(this::resizeBottomRight); - window.setY(settings.windowYPositionProperty().get()); - window.setX(settings.windowXPositionProperty().get()); window.setHeight(settings.windowHeightProperty().get()); //TODO: remove comments //window.setHeight(settings.windowHeightProperty().get() > window.getMaxHeight() ? window.getMaxHeight() * 0.95 : settings.windowHeightProperty().get()); window.setWidth(settings.windowWidthProperty().get()); //window.setWidth(settings.windowWidthProperty().get() > window.getMaxWidth() ? window.getMaxWidth() * 0.95 : settings.windowWidthProperty().get()); + + + //TODO: define illegalPosition + boolean illegalPosition = false; + if (illegalPosition) { + // if the position is illegal, then the window appears on the main screen in the middle of the window. + window.setY((window.getMaxHeight() - window.getHeight()) / 2); + window.setX((window.getMaxWidth() - window.getWidth()) / 2); + } + else { + window.setX(settings.windowXPositionProperty().get()); + window.setY(settings.windowYPositionProperty().get()); + } + } private void startResize(MouseEvent evt) {