diff --git a/d2layouts/d2dagrelayout/layout.go b/d2layouts/d2dagrelayout/layout.go index bb5bbe506..1272105fe 100644 --- a/d2layouts/d2dagrelayout/layout.go +++ b/d2layouts/d2dagrelayout/layout.go @@ -110,7 +110,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err continue } if obj.LabelHeight != nil { - maxContainerLabelHeight = go2.Max(maxContainerLabelHeight, *obj.LabelHeight) + maxContainerLabelHeight = go2.Max(maxContainerLabelHeight, *obj.LabelHeight+label.PADDING) } } @@ -141,7 +141,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err height += float64(*obj.LabelHeight) + label.PADDING } if len(obj.ChildrenArray) > 0 { - obj.Height += float64(*obj.LabelHeight) + height += float64(*obj.LabelHeight) + label.PADDING } } loadScript += generateAddNodeLine(id, int(obj.Width), int(height)) @@ -346,7 +346,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err } // This was artifically added to make dagre consider label height - obj.Height -= float64(*obj.LabelHeight) + obj.Height -= (float64(*obj.LabelHeight) + label.PADDING) movedEdges := make(map[*d2graph.Edge]struct{}) for _, e := range g.Edges { @@ -371,7 +371,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err currDst = currDst.Parent } if isSrcDesc && isDstDesc { - stepSize := float64(*obj.LabelHeight) + stepSize := float64(*obj.LabelHeight) + label.PADDING if e.Src != obj || e.Dst != obj { stepSize /= 2. } @@ -388,7 +388,7 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err curr := q[0] q = q[1:] - stepSize := float64(*obj.LabelHeight) + stepSize := float64(*obj.LabelHeight) + label.PADDING if curr != obj { stepSize /= 2. } diff --git a/d2renderers/d2sketch/testdata/animated/sketch.exp.svg b/d2renderers/d2sketch/testdata/animated/sketch.exp.svg index 4ea57e1cb..847193776 100644 --- a/d2renderers/d2sketch/testdata/animated/sketch.exp.svg +++ b/d2renderers/d2sketch/testdata/animated/sketch.exp.svg @@ -3,7 +3,7 @@ id="d2-svg" style="background: white;" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" -width="486" height="805" viewBox="-102 -105 486 805">aabbllmmnnoocciikkddgghhjjeeff1122 334455667788 - - - - - - - - - +aabbllmmnnoocciikkddgghhjjeeff1122 334455667788 + + + + + + + + + container

they did it in style

-

a header

+container

they did it in style

+

a header

a line of text and an

{
 	indented: "block",
@@ -805,8 +805,8 @@ width="516" height="689" viewBox="-102 -105 516 689">markdown

Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+markdown

Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

-
- +
+ markdown

Lorem ipsum dolor sit amet, consectetur adipiscing elit,
+markdown

Lorem ipsum dolor sit amet, consectetur adipiscing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

-
- +
+ containerscloudtall cylinderclass- +containerscloudtall cylinderclass- num int- timeout @@ -823,8 +823,8 @@ width="2482" height="2675" viewBox="-102 -105 2482 2675">