fix: cr, a clean spilit for temp graph

This commit is contained in:
donglixiaoche 2023-03-30 20:31:42 +08:00
parent ad515e6110
commit a3268f2fd1
No known key found for this signature in database
GPG key ID: 3190E65EBAD6D6E2
2 changed files with 7 additions and 0 deletions

View file

@ -155,6 +155,10 @@ func WithoutConstantNears(ctx context.Context, g *d2graph.Graph) (constantNearGr
tempGraph := d2graph.NewGraph()
tempGraph.Root.ChildrenArray = []*d2graph.Object{obj}
tempGraph.Root.Children[obj.ID] = obj
for _, descendantObj := range descendantObjects {
descendantObj.Graph = tempGraph
}
tempGraph.Objects = descendantObjects
tempGraph.Edges = edges

View file

@ -78,6 +78,9 @@ func compile(ctx context.Context, g *d2graph.Graph, opts *CompileOptions) (*d2ta
return nil, err
}
nearObject.Parent = g.Root
for _, obj := range tempGraph.Objects {
obj.Graph = g
}
}
err = d2sequence.Layout(ctx, g, coreLayout)