fix
This commit is contained in:
parent
2d00cb4bef
commit
86de2cd414
1 changed files with 15 additions and 0 deletions
|
|
@ -101,12 +101,27 @@ func LayoutNested(ctx context.Context, g *d2graph.Graph, graphInfo GraphInfo, co
|
||||||
// if we are in a grid diagram, and our children have descendants
|
// if we are in a grid diagram, and our children have descendants
|
||||||
// we need to run layout on them first, even if they are not special diagram types
|
// we need to run layout on them first, even if they are not special diagram types
|
||||||
nestedGraph := ExtractSubgraph(curr, true)
|
nestedGraph := ExtractSubgraph(curr, true)
|
||||||
|
id := curr.AbsID()
|
||||||
err := LayoutNested(ctx, nestedGraph, GraphInfo{}, coreLayout)
|
err := LayoutNested(ctx, nestedGraph, GraphInfo{}, coreLayout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
InjectNested(g.Root, nestedGraph, false)
|
InjectNested(g.Root, nestedGraph, false)
|
||||||
restoreOrder()
|
restoreOrder()
|
||||||
|
|
||||||
|
// need to update curr *Object incase layout changed it
|
||||||
|
var obj *d2graph.Object
|
||||||
|
for _, o := range g.Objects {
|
||||||
|
if o.AbsID() == id {
|
||||||
|
obj = o
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if obj == nil {
|
||||||
|
return fmt.Errorf("could not find object %#v after layout", id)
|
||||||
|
}
|
||||||
|
curr = obj
|
||||||
|
|
||||||
dx := -curr.TopLeft.X
|
dx := -curr.TopLeft.X
|
||||||
dy := -curr.TopLeft.Y
|
dy := -curr.TopLeft.Y
|
||||||
for _, o := range nestedGraph.Objects {
|
for _, o := range nestedGraph.Objects {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue