Add layout components 001-020 with demos and behavior tests
This commit is contained in:
29 files changed
+2110
-9
No files matched your search
@@ -0,0 +1,19 @@
|
||||
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)
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user