diff --git a/d2layouts/d2sequence/constants.go b/d2layouts/d2sequence/constants.go new file mode 100644 index 000000000..5004ea4d6 --- /dev/null +++ b/d2layouts/d2sequence/constants.go @@ -0,0 +1,9 @@ +package d2sequence + +// min horizontal pad for actors, or edge labels, to consider the min distance between them +const MIN_HORIZONTAL_PAD = 50. + +const MIN_ACTOR_DISTANCE = 200. + +// min vertical distance between edges +const MIN_EDGE_DISTANCE = 100. diff --git a/d2layouts/d2sequence/layout.go b/d2layouts/d2sequence/layout.go index a637b16af..ebe17b2ff 100644 --- a/d2layouts/d2sequence/layout.go +++ b/d2layouts/d2sequence/layout.go @@ -12,9 +12,9 @@ import ( ) func Layout(ctx context.Context, g *d2graph.Graph) (err error) { - pad := 50. // 2 * 25 - edgeYStep := 100. - actorXStep := 200. + pad := MIN_HORIZONTAL_PAD + edgeYStep := MIN_EDGE_DISTANCE + actorXStep := MIN_ACTOR_DISTANCE maxActorHeight := 0. for _, edge := range g.Edges {