Skip to content

Commit ee74208

Browse files
Kr0noxEntenwilli
authored andcommitted
layout on url load
1 parent 3cee66d commit ee74208

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

frontend/webEditor/src/startUpAgent/LoadDefaultDiagram.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@ import { IStartUpAgent } from "./StartUpAgent";
33
import { LoadDefaultDiagramAction } from "../serialize/loadDefaultDiagram";
44
import { inject } from "inversify";
55
import { LoadFromUrlAction } from "../serialize/LoadUrl";
6+
import { LayoutModelAction } from "../layout/command";
7+
import { LayoutMethod } from "../layout/layoutMethod";
68

79
export class LoadDefaultDiagramStartUpAgent implements IStartUpAgent {
810
constructor(@inject(TYPES.IActionDispatcher) private actionDispatcher: ActionDispatcher) {}
911

1012
run(): void {
1113
const urlParams = new URLSearchParams(window.location.search);
1214
const fileUrlParameter = urlParams.get("file");
13-
this.actionDispatcher.dispatch(
15+
const doLayout = urlParams.get("layout") === "true";
16+
const actions = [
1417
fileUrlParameter != undefined
1518
? LoadFromUrlAction.create(fileUrlParameter)
1619
: LoadDefaultDiagramAction.create(),
17-
);
20+
];
21+
if (doLayout) {
22+
actions.push(LayoutModelAction.create(LayoutMethod.LINES));
23+
}
24+
this.actionDispatcher.dispatchAll(actions);
1825
}
1926
}

0 commit comments

Comments
 (0)