From 4d4865570df849cb2b1b0a33f7984f8be9021cf4 Mon Sep 17 00:00:00 2001 From: kske Date: Fri, 6 Nov 2020 09:21:59 +0100 Subject: [PATCH] Make resizability a property of SceneInfo This removes a check hard coded into SceneContext that sets LoginScene to not resizable. --- .../src/main/java/envoy/client/ui/SceneContext.java | 5 +---- client/src/main/java/envoy/client/ui/SceneInfo.java | 12 +++++++++++- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/client/src/main/java/envoy/client/ui/SceneContext.java b/client/src/main/java/envoy/client/ui/SceneContext.java index b86d843..dcae7a9 100644 --- a/client/src/main/java/envoy/client/ui/SceneContext.java +++ b/client/src/main/java/envoy/client/ui/SceneContext.java @@ -77,11 +77,8 @@ public final class SceneContext implements EventListener { scene.getAccelerators() .putAll(((KeyboardMapping) controller).getKeyboardShortcuts()); - // The LoginScene is the only scene not intended to be resized - // As strange as it seems, this is needed as otherwise the LoginScene won't be - // displayed on some OS (...Debian...) + Platform.runLater(() -> stage.setResizable(sceneInfo.resizable)); stage.sizeToScene(); - Platform.runLater(() -> stage.setResizable(sceneInfo != SceneInfo.LOGIN_SCENE)); applyCSS(); stage.show(); } catch (final IOException e) { diff --git a/client/src/main/java/envoy/client/ui/SceneInfo.java b/client/src/main/java/envoy/client/ui/SceneInfo.java index 801e947..9f851e6 100644 --- a/client/src/main/java/envoy/client/ui/SceneInfo.java +++ b/client/src/main/java/envoy/client/ui/SceneInfo.java @@ -27,14 +27,24 @@ public enum SceneInfo { * * @since Envoy Client v0.1-beta */ - LOGIN_SCENE("/fxml/LoginScene.fxml"); + LOGIN_SCENE("/fxml/LoginScene.fxml", false); /** * The path to the FXML resource. */ public final String path; + /** + * Whether the scene should be resizable. + */ + public final boolean resizable; + SceneInfo(String path) { + this(path, true); + } + + SceneInfo(String path, boolean resizable) { this.path = path; + this.resizable = resizable; } } \ No newline at end of file