src change
This commit is contained in:
parent
0de29f08c3
commit
edff033308
3 changed files with 4 additions and 4 deletions
|
|
@ -39,7 +39,6 @@ func NewGraph(ast *d2ast.Map) *Graph {
|
||||||
Parent: nil,
|
Parent: nil,
|
||||||
Children: make(map[string]*Object),
|
Children: make(map[string]*Object),
|
||||||
}
|
}
|
||||||
d.Root.Attributes.Direction.Value = "down"
|
|
||||||
return d
|
return d
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -445,9 +444,6 @@ func (obj *Object) newObject(id string) *Object {
|
||||||
Label: Scalar{
|
Label: Scalar{
|
||||||
Value: idval,
|
Value: idval,
|
||||||
},
|
},
|
||||||
Direction: Scalar{
|
|
||||||
Value: "down",
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Graph: obj.Graph,
|
Graph: obj.Graph,
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,8 @@ func Layout(ctx context.Context, d2graph *d2graph.Graph) (err error) {
|
||||||
rootAttrs.rankdir = "RL"
|
rootAttrs.rankdir = "RL"
|
||||||
case "up":
|
case "up":
|
||||||
rootAttrs.rankdir = "BT"
|
rootAttrs.rankdir = "BT"
|
||||||
|
default:
|
||||||
|
rootAttrs.rankdir = "TB"
|
||||||
}
|
}
|
||||||
configJS := setGraphAttrs(rootAttrs)
|
configJS := setGraphAttrs(rootAttrs)
|
||||||
if _, err := v8ctx.RunScript(configJS, "config.js"); err != nil {
|
if _, err := v8ctx.RunScript(configJS, "config.js"); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -131,6 +131,8 @@ func Layout(ctx context.Context, g *d2graph.Graph) (err error) {
|
||||||
elkGraph.LayoutOptions.Direction = "RIGHT"
|
elkGraph.LayoutOptions.Direction = "RIGHT"
|
||||||
case "left":
|
case "left":
|
||||||
elkGraph.LayoutOptions.Direction = "LEFT"
|
elkGraph.LayoutOptions.Direction = "LEFT"
|
||||||
|
default:
|
||||||
|
elkGraph.LayoutOptions.Direction = "DOWN"
|
||||||
}
|
}
|
||||||
|
|
||||||
elkNodes := make(map[*d2graph.Object]*ELKNode)
|
elkNodes := make(map[*d2graph.Object]*ELKNode)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue