Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Mar 6, 2023
1 parent 843720e commit 3ad2ff4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions d2layouts/d2elklayout/layout.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,18 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
}

walk(g.Root, nil, func(obj, parent *d2graph.Object) {
incoming := 0.
outgoing := 0.
for _, e := range g.Edges {
if e.Src == obj {
outgoing++
}
if e.Dst == obj {
incoming++
}
}
obj.Width = math.Max(obj.Width, math.Max(incoming, outgoing)*80)

height := obj.Height
width := obj.Width
if obj.LabelWidth != nil && obj.LabelHeight != nil {
Expand Down

0 comments on commit 3ad2ff4

Please sign in to comment.