forked from j62/ctbrec
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();
|
Player.scene = primaryStage.getScene();
|
||||||
primaryStage.setX(Config.getInstance().getSettings().windowX);
|
primaryStage.setX(Config.getInstance().getSettings().windowX);
|
||||||
primaryStage.setY(Config.getInstance().getSettings().windowY);
|
primaryStage.setY(Config.getInstance().getSettings().windowY);
|
||||||
primaryStage.xProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowX = newVal.intValue());
|
primaryStage.xProperty().addListener((observable, oldVal, newVal) -> {
|
||||||
primaryStage.yProperty().addListener((observable, oldVal, newVal) -> Config.getInstance().getSettings().windowY = newVal.intValue());
|
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.show();
|
||||||
primaryStage.setOnCloseRequest(createShutdownHandler());
|
primaryStage.setOnCloseRequest(createShutdownHandler());
|
||||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> Platform.runLater(this::shutdown)));
|
Runtime.getRuntime().addShutdownHook(new Thread(() -> Platform.runLater(this::shutdown)));
|
||||||
|
|
Loading…
Reference in New Issue