From a9b8b3c0b1778b349427a0af7fc90e1b5e326614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlio=20C=C3=A9sar=20Batista?= Date: Tue, 29 Nov 2022 10:18:32 -0800 Subject: [PATCH] Vertical pad --- d2layouts/d2sequence/constants.go | 3 +++ d2layouts/d2sequence/layout.go | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/d2layouts/d2sequence/constants.go b/d2layouts/d2sequence/constants.go index 884305852..3f184e92f 100644 --- a/d2layouts/d2sequence/constants.go +++ b/d2layouts/d2sequence/constants.go @@ -3,6 +3,9 @@ package d2sequence // leaves at least 25 units of space on the left/right when computing the space required between actors const HORIZONTAL_PAD = 50. +// leaves at least 25 units of space on the top/bottom when computing the space required between edges +const VERTICAL_PAD = 50. + const MIN_ACTOR_DISTANCE = 200. // min vertical distance between edges diff --git a/d2layouts/d2sequence/layout.go b/d2layouts/d2sequence/layout.go index 26c3335d9..5ca1a5388 100644 --- a/d2layouts/d2sequence/layout.go +++ b/d2layouts/d2sequence/layout.go @@ -69,7 +69,7 @@ func (sd *sequenceDiagram) init() { sd.actors = append(sd.actors, obj) sd.objectRank[obj] = len(sd.actors) sd.objectDepth[obj] = 0 - sd.maxActorHeight = math.Max(sd.maxActorHeight, obj.Height+HORIZONTAL_PAD) + sd.maxActorHeight = math.Max(sd.maxActorHeight, obj.Height+VERTICAL_PAD) } else { // activations boxes are always rectangles and have no labels obj.Attributes.Label = d2graph.Scalar{Value: ""} @@ -83,7 +83,7 @@ func (sd *sequenceDiagram) init() { } for rank, edge := range sd.edges { - sd.edgeYStep = math.Max(sd.edgeYStep, float64(edge.LabelDimensions.Height)+HORIZONTAL_PAD) + sd.edgeYStep = math.Max(sd.edgeYStep, float64(edge.LabelDimensions.Height)+VERTICAL_PAD) sd.setMinMaxEdgeRank(edge.Src, rank) sd.setMinMaxEdgeRank(edge.Dst, rank)