Vertical pad

This commit is contained in:
Júlio César Batista 2022-11-29 10:18:32 -08:00
parent ebac99e3db
commit a9b8b3c0b1
No known key found for this signature in database
GPG key ID: 10C4B861BF314878
2 changed files with 5 additions and 2 deletions

View file

@ -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

View file

@ -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)