Only save new window coordinates, if the window stays visible
This commit is contained in:
parent
8e2999241f
commit
00c7e463b5
|
@ -254,8 +254,16 @@ public class CamrecApplication extends Application {
|
|||
Player.scene = primaryStage.getScene();
|
||||
primaryStage.setX(Config.getInstance().getSettings().windowX);
|
||||
primaryStage.setY(Config.getInstance().getSettings().windowY);
|
||||
primaryStage.xProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowX = newVal.intValue());
|
||||
primaryStage.yProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowY = newVal.intValue());
|
||||
primaryStage.xProperty().addListener((observable, oldVal, newVal) -> {
|
||||
if (newVal.doubleValue() + primaryStage.getWidth() > 0) {
|
||||
Config.getInstance().getSettings().windowX = newVal.intValue();
|
||||
}
|
||||
});
|
||||
primaryStage.yProperty().addListener((observable, oldVal, newVal) -> {
|
||||
if (newVal.doubleValue() + primaryStage.getHeight() > 0) {
|
||||
Config.getInstance().getSettings().windowY = newVal.intValue();
|
||||
}
|
||||
});
|
||||
primaryStage.show();
|
||||
primaryStage.setOnCloseRequest(createShutdownHandler());
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> Platform.runLater(this::shutdown)));
|
||||
|
|
Loading…
Reference in New Issue