20 lines
399 B
Go
20 lines
399 B
Go
package layout
|
|
|
|
import "github.com/egoist/mygo/ui"
|
|
|
|
// Layers stacks layers in a box; the first sizes it.
|
|
func Layers(c *ui.Context, layers ...func()) *ui.Element {
|
|
if len(layers) == 0 {
|
|
panic("layout: Layers needs a layer")
|
|
}
|
|
return ui.Box(c).Children(func() {
|
|
for i, l := range layers {
|
|
b := ui.Box(c).Fill()
|
|
if i > 0 {
|
|
b.Absolute().Top(0).Left(0)
|
|
}
|
|
b.Children(l)
|
|
}
|
|
})
|
|
}
|