Move constants to a file
This commit is contained in:
parent
b415c6c858
commit
909f9fc6c9
2 changed files with 12 additions and 3 deletions
9
d2layouts/d2sequence/constants.go
Normal file
9
d2layouts/d2sequence/constants.go
Normal 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.
|
||||||
|
|
@ -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 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue