Skip to content

Commit

Permalink
adjusted padding of cs nodes with children
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakae committed Feb 9, 2024
1 parent c61bb40 commit a81b01c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ export class FtaDiagramGenerator extends LangiumDiagramGenerator {
layoutOptions: {
paddingTop: 0.0,
paddingBottom: 10.0,
paddngLeft: 0.0,
paddingLeft: 0.0,
paddingRight: 0.0,
},
};
Expand Down
16 changes: 10 additions & 6 deletions extension/src-language-server/stpa/diagram/diagram-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,8 @@ export class StpaDiagramGenerator extends LangiumDiagramGenerator {
[],
edgeType,
sEdgeType,
args
args,
false
)
);
}
Expand All @@ -897,7 +898,8 @@ export class StpaDiagramGenerator extends LangiumDiagramGenerator {
[],
edgeType,
sEdgeType,
args
args,
false
)
);
}
Expand Down Expand Up @@ -1033,15 +1035,16 @@ export class StpaDiagramGenerator extends LangiumDiagramGenerator {
label: string[],
edgeType: EdgeType,
sedgeType: string,
args: GeneratorContext<Model>
args: GeneratorContext<Model>,
dummyLabel: boolean = true
): CSEdge {
return {
type: sedgeType,
id: edgeId,
sourceId: sourceId!,
targetId: targetId!,
edgeType: edgeType,
children: this.createLabel(label, edgeId, args.idCache),
children: this.createLabel(label, edgeId, args.idCache, undefined, dummyLabel),
};
}

Expand All @@ -1055,7 +1058,8 @@ export class StpaDiagramGenerator extends LangiumDiagramGenerator {
label: string[],
id: string,
idCache: IdCache<AstNode>,
type: string = "label:xref"
type: string = "label:xref",
dummyLabel: boolean = true
): SLabel[] {
const children: SLabel[] = [];
if (label.find(l => l !== "")) {
Expand All @@ -1066,7 +1070,7 @@ export class StpaDiagramGenerator extends LangiumDiagramGenerator {
text: l,
} as SLabel);
});
} else {
} else if (dummyLabel) {
// needed for correct layout
children.push({
type: type,
Expand Down
2 changes: 2 additions & 0 deletions extension/src-language-server/stpa/diagram/layout-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ export class StpaLayoutConfigurator extends DefaultLayoutConfigurator {
options["org.eclipse.elk.nodeLabels.placement"] = "INSIDE V_TOP H_CENTER";
options["org.eclipse.elk.direction"] = "DOWN";
options["org.eclipse.elk.partitioning.activate"] = "true";
options["org.eclipse.elk.padding"] = "[top=0.0,left=0.0,bottom=0.0,right=0.0]";
options["org.eclipse.elk.spacing.portPort"] = "0.0";
} else {
// TODO: want H_LEFT but this expands the node more than needed
options["org.eclipse.elk.nodeLabels.placement"] = "INSIDE V_CENTER H_CENTER";
Expand Down

0 comments on commit a81b01c

Please sign in to comment.