Improve Scene Switching #109

Merged
kske merged 5 commits from improved-scene-switching into develop 2020-11-22 11:19:42 +01:00
2 changed files with 12 additions and 5 deletions
Showing only changes of commit 4d4865570d - Show all commits

View File

@ -77,11 +77,8 @@ public final class SceneContext implements EventListener {
scene.getAccelerators() scene.getAccelerators()
.putAll(((KeyboardMapping) controller).getKeyboardShortcuts()); .putAll(((KeyboardMapping) controller).getKeyboardShortcuts());
// The LoginScene is the only scene not intended to be resized Platform.runLater(() -> stage.setResizable(sceneInfo.resizable));
// As strange as it seems, this is needed as otherwise the LoginScene won't be
// displayed on some OS (...Debian...)
stage.sizeToScene(); stage.sizeToScene();
Platform.runLater(() -> stage.setResizable(sceneInfo != SceneInfo.LOGIN_SCENE));
applyCSS(); applyCSS();
stage.show(); stage.show();
} catch (final IOException e) { } catch (final IOException e) {

View File

@ -27,14 +27,24 @@ public enum SceneInfo {
* *
* @since Envoy Client v0.1-beta * @since Envoy Client v0.1-beta
*/ */
LOGIN_SCENE("/fxml/LoginScene.fxml"); LOGIN_SCENE("/fxml/LoginScene.fxml", false);
/** /**
* The path to the FXML resource. * The path to the FXML resource.
*/ */
public final String path; public final String path;
/**
* Whether the scene should be resizable.
*/
public final boolean resizable;
SceneInfo(String path) { SceneInfo(String path) {
this(path, true);
}
SceneInfo(String path, boolean resizable) {
this.path = path; this.path = path;
this.resizable = resizable;
} }
} }