fix groups in dagre

This commit is contained in:
Alexander Wang 2022-12-04 22:41:24 -08:00
parent 83118fb076
commit b8f00f32f1
No known key found for this signature in database
GPG key ID: D89FA31966BDBECE
3 changed files with 9 additions and 6 deletions

View file

@ -56,6 +56,9 @@ func Layout(ctx context.Context, g *d2graph.Graph, layout func(ctx context.Conte
for _, obj := range sd.notes { for _, obj := range sd.notes {
objectsToRemove[obj] = struct{}{} objectsToRemove[obj] = struct{}{}
} }
for _, obj := range sd.groups {
objectsToRemove[obj] = struct{}{}
}
for _, obj := range sd.spans { for _, obj := range sd.spans {
objectsToRemove[obj] = struct{}{} objectsToRemove[obj] = struct{}{}
} }
@ -151,6 +154,7 @@ func cleanup(g *d2graph.Graph, sequenceDiagrams map[string]*sequenceDiagram, obj
g.Edges = append(g.Edges, sequenceDiagrams[obj.AbsID()].lifelines...) g.Edges = append(g.Edges, sequenceDiagrams[obj.AbsID()].lifelines...)
g.Objects = append(g.Objects, sequenceDiagrams[obj.AbsID()].actors...) g.Objects = append(g.Objects, sequenceDiagrams[obj.AbsID()].actors...)
g.Objects = append(g.Objects, sequenceDiagrams[obj.AbsID()].notes...) g.Objects = append(g.Objects, sequenceDiagrams[obj.AbsID()].notes...)
g.Objects = append(g.Objects, sequenceDiagrams[obj.AbsID()].groups...)
g.Objects = append(g.Objects, sequenceDiagrams[obj.AbsID()].spans...) g.Objects = append(g.Objects, sequenceDiagrams[obj.AbsID()].spans...)
} }

View file

@ -8,8 +8,8 @@
"x": 0, "x": 0,
"y": 0 "y": 0
}, },
"width": 1508, "width": 2193,
"height": 180, "height": 2288,
"opacity": 1, "opacity": 1,
"strokeDash": 0, "strokeDash": 0,
"strokeWidth": 2, "strokeWidth": 2,
@ -356,8 +356,8 @@
"id": "How this is rendered.only if root is not sequence", "id": "How this is rendered.only if root is not sequence",
"type": "", "type": "",
"pos": { "pos": {
"x": 50, "x": 730,
"y": 50 "y": 1338
}, },
"width": 1408, "width": 1408,
"height": 80, "height": 80,
@ -387,7 +387,6 @@
"underline": false, "underline": false,
"labelWidth": 195, "labelWidth": 195,
"labelHeight": 26, "labelHeight": 26,
"labelPosition": "INSIDE_MIDDLE_CENTER",
"zIndex": 1, "zIndex": 1,
"level": 2 "level": 2
}, },

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 479 KiB

After

Width:  |  Height:  |  Size: 479 KiB