Elements are now pass-scoped value handles: tests that read bounds after a frame bind a ui.Handle. pixel tells frames apart by the build pass's root, since the Tester clock no longer moves on its own. Fix the regressions the upgrade brought: - Clipboard reads in input handlers go through c.Services(). - MyGo notes an overlay's opener after building it, so AutoFocus inside lost it; pixel.AutoFocus focuses through a Handle, and archtest bans the raw call. Dialogs hand the focus back again. - Elements around a press stay hovered: Tooltip tells a press-given focus by focus arriving under the pointer. - The web host moves the Tester clock with real time, at most 500 ms a call, and gives components the real clock. The gallery's source index also accepts CRLF checkouts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
28 lines
645 B
Go
28 lines
645 B
Go
package layout
|
|
|
|
import (
|
|
"github.com/egoist/mygo/ui"
|
|
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
|
)
|
|
|
|
type TilesOptions struct {
|
|
// W is zero for 48; H is zero for W.
|
|
W, H int
|
|
// Gap is zero for 4.
|
|
Gap int
|
|
}
|
|
|
|
// Tiles wraps n equal tiles into rows.
|
|
func Tiles(c *ui.Context, n int, o TilesOptions, tile func(i int)) ui.Element {
|
|
k := pixel.K(c)
|
|
w := pixel.Or("Tiles W", o.W, 48)
|
|
h := pixel.Or("Tiles H", o.H, w)
|
|
pixel.Or("Tiles n", n, 0)
|
|
return ui.Row(c).Wrap().Gap(k.D(pixel.Or("Tiles Gap", o.Gap, 4))).Children(func() {
|
|
for i := range n {
|
|
ui.Box(c).Size(k.D(w), k.D(h)).Clip().Children(func() { tile(i) })
|
|
}
|
|
})
|
|
}
|