This commit is contained in:
Gavin Nishizawa 2023-09-13 20:04:25 -07:00
parent dbf4a86134
commit c0c66ad36e
No known key found for this signature in database
GPG key ID: AE3B177777CE55CD

View file

@ -60,7 +60,7 @@ func (g *Graph) ExtractAsNestedGraph(obj *Object) *Graph {
func pluckObjAndEdges(g *Graph, obj *Object) (descendantsObjects []*Object, edges []*Edge) {
for i := 0; i < len(g.Edges); i++ {
edge := g.Edges[i]
if edge.Src.IsDescendantOf(obj) || edge.Dst.IsDescendantOf(obj) {
if edge.Src.IsDescendantOf(obj) && edge.Dst.IsDescendantOf(obj) {
edges = append(edges, edge)
g.Edges = append(g.Edges[:i], g.Edges[i+1:]...)
i--
@ -70,7 +70,7 @@ func pluckObjAndEdges(g *Graph, obj *Object) (descendantsObjects []*Object, edge
for i := 0; i < len(g.Objects); i++ {
temp := g.Objects[i]
if temp.IsDescendantOf(obj) {
descendantsObjects = append(descendantsObjects, obj)
descendantsObjects = append(descendantsObjects, temp)
g.Objects = append(g.Objects[:i], g.Objects[i+1:]...)
i--
}