absolute

– import “gomatcha.io/matcha/layout/absolute”

Package absolute implements a fixed layout system similar to HTML absolute positioning. It does not support animations or flexible sizing. For more complex layouts, see the constraint package.

 l := &absolute.Layouter{
    Guide: layout.Guide{Frame: layout.Rt(0, 0, 100, 100)}
 }

 childView := NewChildView(...)
 l.Add(childView, layout.Guide{Frame: layout.Rt(10, 10, 90, 90)})

 return view.Model{
    Views: l.Views(),
    Layouter:l,
 }

type Layouter

type Layouter struct {
	// Layout guide for the view.
	Guide layout.Guide
}

func (*Layouter) Add

func (l *Layouter) Add(v view.View, g layout.Guide)

Add adds v to the layouter and positions it with g.

func (*Layouter) Layout

func (l *Layouter) Layout(ctx layout.Context) (layout.Guide, []layout.Guide)

Layout implements the view.Layouter interface.

func (*Layouter) Notify

func (l *Layouter) Notify(f func()) comm.Id

Notify implements the view.Layouter interface.

func (*Layouter) Unnotify

func (l *Layouter) Unnotify(id comm.Id)

Unnotify implements the view.Layouter interface.

func (*Layouter) Views

func (l *Layouter) Views() []view.View

Views returns all views that have been added to l.