handle straight line
This commit is contained in:
parent
e9bc363be4
commit
25e37fd0c4
1 changed files with 11 additions and 9 deletions
|
|
@ -263,18 +263,20 @@ func Layout(ctx context.Context, g *d2graph.Graph, opts *ConfigurableOpts) (err
|
||||||
|
|
||||||
path := make([]*geo.Point, 0)
|
path := make([]*geo.Point, 0)
|
||||||
path = append(path, points[0])
|
path = append(path, points[0])
|
||||||
path = append(path, points[0].AddVector(vectors[0].Multiply(.8)))
|
if len(vectors) > 1 {
|
||||||
for i := 1; i < len(vectors)-2; i++ {
|
path = append(path, points[0].AddVector(vectors[0].Multiply(.8)))
|
||||||
p := points[i]
|
for i := 1; i < len(vectors)-2; i++ {
|
||||||
v := vectors[i]
|
p := points[i]
|
||||||
path = append(path, p.AddVector(v.Multiply(.2)))
|
v := vectors[i]
|
||||||
path = append(path, p.AddVector(v.Multiply(.5)))
|
path = append(path, p.AddVector(v.Multiply(.2)))
|
||||||
path = append(path, p.AddVector(v.Multiply(.8)))
|
path = append(path, p.AddVector(v.Multiply(.5)))
|
||||||
|
path = append(path, p.AddVector(v.Multiply(.8)))
|
||||||
|
}
|
||||||
|
path = append(path, points[len(points)-2].AddVector(vectors[len(vectors)-1].Multiply(.2)))
|
||||||
|
edge.IsCurve = true
|
||||||
}
|
}
|
||||||
path = append(path, points[len(points)-2].AddVector(vectors[len(vectors)-1].Multiply(.2)))
|
|
||||||
path = append(path, points[len(points)-1])
|
path = append(path, points[len(points)-1])
|
||||||
|
|
||||||
edge.IsCurve = true
|
|
||||||
edge.Route = path
|
edge.Route = path
|
||||||
// compile needs to assign edge label positions
|
// compile needs to assign edge label positions
|
||||||
if edge.Attributes.Label.Value != "" {
|
if edge.Attributes.Label.Value != "" {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue