update strategy for nested grid cell layout
This commit is contained in:
parent
c9d5003343
commit
7b28c9290c
1 changed files with 7 additions and 1 deletions
|
|
@ -106,6 +106,7 @@ func LayoutNested(ctx context.Context, g *d2graph.Graph, graphInfo GraphInfo, co
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
InjectNested(g.Root, nestedGraph, false)
|
InjectNested(g.Root, nestedGraph, false)
|
||||||
restoreOrder()
|
restoreOrder()
|
||||||
|
|
||||||
|
|
@ -135,6 +136,12 @@ func LayoutNested(ctx context.Context, g *d2graph.Graph, graphInfo GraphInfo, co
|
||||||
for _, e := range nestedGraph.Edges {
|
for _, e := range nestedGraph.Edges {
|
||||||
e.Move(dx, dy)
|
e.Move(dx, dy)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// now we keep the descendants out until after grid layout
|
||||||
|
nestedGraph = ExtractSubgraph(curr, false)
|
||||||
|
|
||||||
|
extracted[id] = nestedGraph
|
||||||
|
extractedOrder = append(extractedOrder, id)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -330,7 +337,6 @@ func ExtractSubgraph(container *d2graph.Object, includeSelf bool) *d2graph.Graph
|
||||||
}
|
}
|
||||||
|
|
||||||
func InjectNested(container *d2graph.Object, nestedGraph *d2graph.Graph, isRoot bool) {
|
func InjectNested(container *d2graph.Object, nestedGraph *d2graph.Graph, isRoot bool) {
|
||||||
// TODO restore order of objects
|
|
||||||
g := container.Graph
|
g := container.Graph
|
||||||
for _, obj := range nestedGraph.Root.ChildrenArray {
|
for _, obj := range nestedGraph.Root.ChildrenArray {
|
||||||
obj.Parent = container
|
obj.Parent = container
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue