fix
This commit is contained in:
parent
7a552e9a55
commit
bacb22797c
1 changed files with 10 additions and 13 deletions
|
|
@ -127,27 +127,24 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
|||
}
|
||||
}
|
||||
|
||||
maxLabelSize := 0
|
||||
maxLabelWidth := 0
|
||||
maxLabelHeight := 0
|
||||
for _, edge := range g.Edges {
|
||||
size := edge.LabelDimensions.Width
|
||||
if !isHorizontal {
|
||||
size = edge.LabelDimensions.Height
|
||||
}
|
||||
maxLabelSize = go2.Max(maxLabelSize, size)
|
||||
width := edge.LabelDimensions.Width
|
||||
height := edge.LabelDimensions.Height
|
||||
maxLabelWidth = go2.Max(maxLabelWidth, width)
|
||||
maxLabelHeight = go2.Max(maxLabelHeight, height)
|
||||
}
|
||||
|
||||
rootAttrs.ranksep = go2.Max(100, maxLabelSize+40)
|
||||
vSep := go2.Max(rootAttrs.ranksep, maxContainerLabelHeight)
|
||||
// var nonContainerVSep int
|
||||
if !isHorizontal {
|
||||
rootAttrs.ranksep = vSep
|
||||
rootAttrs.ranksep = go2.Max(go2.Max(100, maxLabelHeight+40), maxContainerLabelHeight)
|
||||
} else {
|
||||
rootAttrs.ranksep = go2.Max(100, maxLabelWidth+40)
|
||||
// use existing config
|
||||
rootAttrs.NodeSep = rootAttrs.EdgeSep
|
||||
// configure vertical padding
|
||||
rootAttrs.EdgeSep = vSep
|
||||
// non-containers have both of this as padding
|
||||
// nonContainerVSep = rootAttrs.NodeSep + rootAttrs.EdgeSep
|
||||
rootAttrs.EdgeSep = go2.Max(maxLabelHeight+40, maxContainerLabelHeight)
|
||||
// Note: non-containers have both of these as padding (rootAttrs.NodeSep + rootAttrs.EdgeSep)
|
||||
}
|
||||
|
||||
configJS := setGraphAttrs(rootAttrs)
|
||||
|
|
|
|||
Loading…
Reference in a new issue