github.com/jmigpin/editor@v1.6.0/util/uiutil/widget/freelayout.go (about)

     1  package widget
     2  
     3  type FreeLayout struct {
     4  	ENode
     5  }
     6  
     7  func NewFreeLayout() *FreeLayout {
     8  	return &FreeLayout{}
     9  }
    10  
    11  func (fl *FreeLayout) Layout() {
    12  	fl.IterateWrappers2(func(child Node) {
    13  		m := child.Measure(fl.Bounds.Size())
    14  		b := fl.Bounds
    15  		b.Max = b.Min.Add(m)
    16  		b = b.Intersect(fl.Bounds)
    17  		child.Embed().Bounds = b
    18  	})
    19  }