From c2b5cb9e56a600b3399ba03ff8999122c82e4c42 Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Mon, 26 Jun 2023 11:58:16 -0700 Subject: [PATCH] cleanup --- d2graph/d2graph.go | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index 9feb43fda..eb47de274 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -73,37 +73,6 @@ func (g *Graph) RootBoard() *Graph { return g } -// DeleteObject deletes an object along with all its descendants. -// It also deletes all edges connected to it or a descendant. -func (g *Graph) DeleteObject(obj *Object) { - for i, obj2 := range g.Objects { - if obj == obj2 { - g.Objects = append(g.Objects[:i], g.Objects[i+1:]...) - i-- - } - } - obj.Parent.removeChild(obj) - - for i, e := range g.Edges { - if e.Src == obj || e.Dst == obj { - g.Edges = append(g.Edges[:i], g.Edges[i+1:]...) - } - } - - for _, ch := range obj.ChildrenArray { - g.DeleteObject(ch) - } -} - -func (g *Graph) DeleteEdge(e *Edge) { - for i, e2 := range g.Edges { - if e == e2 { - g.Edges = append(g.Edges[:i], g.Edges[i+1:]...) - i-- - } - } -} - type LayoutGraph func(context.Context, *Graph) error // TODO consider having different Scalar types