func (ds *DrawState) Add(o object.Object) error { // Must have an Id to add an object if len(o.Id()) == 0 { return fmt.Errorf("Cannot add object: ID not set") } if p, ok := o.(*object.Panel); ok { var err error for panelObject := range p.Contains { err = ds.Add(p.Contains[panelObject]) if err != nil { return err } } return err } // Add to users map store ds.Objects[o.Id()] = o // Add to users array object store ds.objectArr = append(ds.objectArr, o) // Add to objects Dirty array return ds.Dirty.Add(o.Size(), o.Coord(), o) }