瀏覽代碼

set the position on illegal position

Martin Beyer 3 年之前
父節點
當前提交
58d65c609f
共有 1 個文件被更改,包括 14 次插入2 次删除
  1. 14 2
      src/main/java/org/cryptomator/ui/mainwindow/ResizeController.java

+ 14 - 2
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) {