fix: cr, attach objects of tempGraph
This commit is contained in:
parent
e61629e692
commit
59ef4ad832
1 changed files with 2 additions and 11 deletions
|
|
@ -52,18 +52,16 @@ func Layout(ctx context.Context, g *d2graph.Graph, constantNearGraphs []*d2graph
|
||||||
point.Y += dy
|
point.Y += dy
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g.Edges = append(g.Edges, tempGraph.Edges...)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for _, tempGraph := range constantNearGraphs {
|
for _, tempGraph := range constantNearGraphs {
|
||||||
obj := tempGraph.Root.ChildrenArray[0]
|
obj := tempGraph.Root.ChildrenArray[0]
|
||||||
if processCenters == strings.Contains(d2graph.Key(obj.Attributes.NearKey)[0], "-center") {
|
if processCenters == strings.Contains(d2graph.Key(obj.Attributes.NearKey)[0], "-center") {
|
||||||
// The z-index for constant nears does not matter, as it will not collide
|
// The z-index for constant nears does not matter, as it will not collide
|
||||||
g.Objects = append(g.Objects, obj)
|
g.Objects = append(g.Objects, tempGraph.Objects...)
|
||||||
obj.Parent.Children[obj.ID] = obj
|
obj.Parent.Children[obj.ID] = obj
|
||||||
obj.Parent.ChildrenArray = append(obj.Parent.ChildrenArray, obj)
|
obj.Parent.ChildrenArray = append(obj.Parent.ChildrenArray, obj)
|
||||||
attachChildren(g, obj)
|
g.Edges = append(g.Edges, tempGraph.Edges...)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -71,13 +69,6 @@ func Layout(ctx context.Context, g *d2graph.Graph, constantNearGraphs []*d2graph
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func attachChildren(g *d2graph.Graph, obj *d2graph.Object) {
|
|
||||||
for _, child := range obj.ChildrenArray {
|
|
||||||
g.Objects = append(g.Objects, child)
|
|
||||||
attachChildren(g, child)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// place returns the position of obj, taking into consideration its near value and the diagram
|
// place returns the position of obj, taking into consideration its near value and the diagram
|
||||||
func place(obj *d2graph.Object) (float64, float64) {
|
func place(obj *d2graph.Object) (float64, float64) {
|
||||||
tl, br := boundingBox(obj.Graph)
|
tl, br := boundingBox(obj.Graph)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue