package npc import ( "fmt" "fyne.io/fyne/v2" "fyne.io/fyne/v2/container" ) type FieldEditor struct { Representation *fyne.Container Creators []*FieldCreator } var fieldEditor *FieldEditor func GetFieldEditor() *FieldEditor { if fieldEditor == nil { container := container.NewGridWrap(fyne.NewSize(200, 150)) fieldEditor = &FieldEditor{container, []*FieldCreator{}} container.Add(GetAdder()) } return fieldEditor } func (ed *FieldEditor) AddFieldCreator(fieldCreator *FieldCreator) { ed.Creators = append(fieldEditor.Creators, fieldCreator) ed.Redraw() } func (ed *FieldEditor) Redraw() { ed.Representation.RemoveAll() for _, v := range ed.Creators { ed.Representation.Add(v.Representation) fmt.Printf("Minsize: %f, %f", v.Representation.MinSize().Height, v.Representation.MinSize().Width) } ed.Representation.Add(GetAdder()) }