func (me *Tree) RemoveInside(bounds geom.Rect, collection map[Item]bool) { if !geom.RectsIntersect(bounds, me.UpperBounds) { return } if me.BigElements != nil { for elem := range me.BigElements { if bounds.ContainsRect(elem.Bounds()) { delete(me.BigElements, elem) if collection != nil { collection[elem] = true } } } } if me.Elements != nil { for elem := range me.Elements { if bounds.ContainsRect(elem.Bounds()) { delete(me.Elements, elem) if collection != nil { collection[elem] = true } } } } for _, t := range me.Subtrees { if t == nil { continue } t.RemoveInside(bounds, collection) } return }