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 {
|
for _, edge := range g.Edges {
|
||||||
size := edge.LabelDimensions.Width
|
width := edge.LabelDimensions.Width
|
||||||
if !isHorizontal {
|
height := edge.LabelDimensions.Height
|
||||||
size = edge.LabelDimensions.Height
|
maxLabelWidth = go2.Max(maxLabelWidth, width)
|
||||||
}
|
maxLabelHeight = go2.Max(maxLabelHeight, height)
|
||||||
maxLabelSize = go2.Max(maxLabelSize, size)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rootAttrs.ranksep = go2.Max(100, maxLabelSize+40)
|
|
||||||
vSep := go2.Max(rootAttrs.ranksep, maxContainerLabelHeight)
|
|
||||||
// var nonContainerVSep int
|
|
||||||
if !isHorizontal {
|
if !isHorizontal {
|
||||||
rootAttrs.ranksep = vSep
|
rootAttrs.ranksep = go2.Max(go2.Max(100, maxLabelHeight+40), maxContainerLabelHeight)
|
||||||
} else {
|
} else {
|
||||||
|
rootAttrs.ranksep = go2.Max(100, maxLabelWidth+40)
|
||||||
// use existing config
|
// use existing config
|
||||||
rootAttrs.NodeSep = rootAttrs.EdgeSep
|
rootAttrs.NodeSep = rootAttrs.EdgeSep
|
||||||
// configure vertical padding
|
// configure vertical padding
|
||||||
rootAttrs.EdgeSep = vSep
|
rootAttrs.EdgeSep = go2.Max(maxLabelHeight+40, maxContainerLabelHeight)
|
||||||
// non-containers have both of this as padding
|
// Note: non-containers have both of these as padding (rootAttrs.NodeSep + rootAttrs.EdgeSep)
|
||||||
// nonContainerVSep = rootAttrs.NodeSep + rootAttrs.EdgeSep
|
|
||||||
}
|
}
|
||||||
|
|
||||||
configJS := setGraphAttrs(rootAttrs)
|
configJS := setGraphAttrs(rootAttrs)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue