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>
44 lines
1.2 KiB
Go
44 lines
1.2 KiB
Go
package account
|
|
|
|
import (
|
|
"github.com/egoist/mygo/ui"
|
|
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/text"
|
|
)
|
|
|
|
// Credit is a role and who filled it.
|
|
type Credit struct {
|
|
Role, Name string
|
|
}
|
|
|
|
type AboutOptions struct {
|
|
Credits []Credit
|
|
}
|
|
|
|
// About shows the title as a logo, version, then credits.
|
|
func About(c *ui.Context, title, version string, o AboutOptions) ui.Element {
|
|
k := pixel.K(c)
|
|
if version == "" {
|
|
panic("account: About needs a version")
|
|
}
|
|
return ui.Column(c).Gap(k.D(4)).AlignItems(ui.Center).Role(ui.RoleGroup).Label(title).Children(func() {
|
|
text.OutlineText(c, title, text.OutlineTextOptions{Slot: pixel.Accent, Scale: 3})
|
|
pixel.Text(c, k.Msg("version")+" "+version, pixel.TextOptions{Slot: pixel.Faint})
|
|
if len(o.Credits) == 0 {
|
|
return
|
|
}
|
|
ui.Box(c).Size(k.D(80), k.D(5)).Draw(func(p *ui.Painter, r ui.Rect) {
|
|
g := k.Canvas(p, r)
|
|
for x := 0; x < g.W; x += 4 {
|
|
g.Rect(x, 2, 2, 1, pixel.Shade)
|
|
}
|
|
})
|
|
pixel.Text(c, k.Msg("credits"), pixel.TextOptions{Slot: pixel.Accent})
|
|
for _, cr := range o.Credits {
|
|
pixel.Text(c, cr.Role, pixel.TextOptions{Slot: pixel.Faint})
|
|
pixel.Text(c, cr.Name, pixel.TextOptions{})
|
|
}
|
|
})
|
|
}
|