Move constants to a file

This commit is contained in:
Júlio César Batista 2022-11-28 11:41:44 -08:00
parent b415c6c858
commit 909f9fc6c9
No known key found for this signature in database
GPG key ID: 10C4B861BF314878
2 changed files with 12 additions and 3 deletions

View file

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

View file

@ -12,9 +12,9 @@ import (
) )
func Layout(ctx context.Context, g *d2graph.Graph) (err error) { func Layout(ctx context.Context, g *d2graph.Graph) (err error) {
pad := 50. // 2 * 25 pad := MIN_HORIZONTAL_PAD
edgeYStep := 100. edgeYStep := MIN_EDGE_DISTANCE
actorXStep := 200. actorXStep := MIN_ACTOR_DISTANCE
maxActorHeight := 0. maxActorHeight := 0.
for _, edge := range g.Edges { for _, edge := range g.Edges {