Add layout components 001-020 with demos and behavior tests

This commit is contained in:
ZacharyZhang-NY committed 2026-10-11 18:02:26 -04:00
1 parent 08e19833a2
commit 9a7f593892
29 files changed
+2110 -9

No files matched your search

+19
View File
@@ -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)
}
})
}