Upgrade MyGo to v0.5.5
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>
This commit is contained in:
1 parent
1f3d38110e
commit
03e1f91706
532 files changed
+828
-735
No files matched your search
+1
-1
@@ -16,7 +16,7 @@ type BreakpointsOptions struct {
|
||||
}
|
||||
|
||||
type BreakpointsResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ type CodeBlockOptions struct {
|
||||
}
|
||||
|
||||
type CodeBlockResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Copied bool
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ type CommandHistoryOptions struct {
|
||||
}
|
||||
|
||||
type CommandHistoryResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Rerun is Enter or a double click on a command.
|
||||
Changed, Rerun bool
|
||||
}
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ type CrashScreenOptions struct {
|
||||
}
|
||||
|
||||
type CrashScreenResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Continue bool
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ type DebugGridOptions struct {
|
||||
}
|
||||
|
||||
// DebugGrid rules content with the dot grid and rulers.
|
||||
func DebugGrid(c *ui.Context, o DebugGridOptions, content func()) *ui.Element {
|
||||
func DebugGrid(c *ui.Context, o DebugGridOptions, content func()) ui.Element {
|
||||
k := pixel.K(c)
|
||||
step := pixel.Or("DebugGrid Step", o.Step, 8)
|
||||
if step < 2 || step > 32 {
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ type change struct {
|
||||
}
|
||||
|
||||
// DiffView marks lines removed with -, added with +.
|
||||
func DiffView(c *ui.Context, text, before, after string, o DiffViewOptions) *ui.Element {
|
||||
func DiffView(c *ui.Context, text, before, after string, o DiffViewOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
changes := diff(strings.Split(tidy(before), "\n"), strings.Split(tidy(after), "\n"))
|
||||
// Rows share the longest width, so tints line up.
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ type FPSMeterOptions struct {
|
||||
}
|
||||
|
||||
// FPSMeter draws frame times as bars, newest right, with percentiles.
|
||||
func FPSMeter(c *ui.Context, text string, frames []time.Duration, o FPSMeterOptions) *ui.Element {
|
||||
func FPSMeter(c *ui.Context, text string, frames []time.Duration, o FPSMeterOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
w, h := pixel.Or("FPSMeter Width", o.Width, 120), pixel.Or("FPSMeter Height", o.Height, 40)
|
||||
for _, f := range frames {
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ type GlyphMapOptions struct {
|
||||
}
|
||||
|
||||
type GlyphMapResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -115,9 +115,9 @@ func TestCrashScreenStepsAtFourFPS(t *testing.T) {
|
||||
tt := view(600, 300, wd, func(c *ui.Context) {
|
||||
code.CrashScreen(c, "panic: oops", nil, code.CrashScreenOptions{})
|
||||
})
|
||||
// Paint asks for the next step on the real clock.
|
||||
// Paint asks for the next step on the frame clock.
|
||||
pixel.ResetDue()
|
||||
before := time.Now()
|
||||
before := tt.Now()
|
||||
tt.Frame()
|
||||
if d := pixel.Due().Sub(before); d < time.Second/4 || d >= time.Second/2 {
|
||||
t.Fatalf("the next blink step is %v away, want a quarter second", d)
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ type HexViewerOptions struct {
|
||||
}
|
||||
|
||||
type HexViewerResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ type LogViewerOptions struct {
|
||||
}
|
||||
|
||||
type LogViewerResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Changed is the level filter.
|
||||
Changed bool
|
||||
}
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ type MemoryMapOptions struct {
|
||||
}
|
||||
|
||||
// MemoryMap draws each bank as a block filled by use.
|
||||
func MemoryMap(c *ui.Context, text string, banks []Bank, o MemoryMapOptions) *ui.Element {
|
||||
func MemoryMap(c *ui.Context, text string, banks []Bank, o MemoryMapOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
cols := pixel.Or("MemoryMap Columns", o.Columns, 4)
|
||||
for _, b := range banks {
|
||||
|
||||
@@ -16,7 +16,7 @@ type PaletteEditorOptions struct {
|
||||
}
|
||||
|
||||
type PaletteEditorResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ type PixelEditorOptions struct {
|
||||
}
|
||||
|
||||
type PixelEditorResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Changed is the art; Copied is COPY.
|
||||
Changed, Copied bool
|
||||
}
|
||||
@@ -129,7 +129,7 @@ func PixelEditor(c *ui.Context, text string, art *string, o PixelEditorOptions)
|
||||
}
|
||||
|
||||
// canvas paints cells, checkers where clear, grid and cursor.
|
||||
func canvas(shell *ui.Element, k pixel.Kit, st pixel.State, cells []int, w, z, cur int, grid bool) {
|
||||
func canvas(shell ui.Element, k pixel.Kit, st pixel.State, cells []int, w, z, cur int, grid bool) {
|
||||
shell.Draw(func(p *ui.Painter, r ui.Rect) {
|
||||
g := k.Canvas(p, r)
|
||||
for i, v := range cells {
|
||||
|
||||
@@ -25,7 +25,7 @@ type ProfilerBarsOptions struct {
|
||||
var depths = []pixel.Slot{pixel.Accent, pixel.Info, pixel.Good, pixel.Warn, pixel.Magic}
|
||||
|
||||
// ProfilerBars stacks spans under their parents, each bar its time.
|
||||
func ProfilerBars(c *ui.Context, text string, root Span, o ProfilerBarsOptions) *ui.Element {
|
||||
func ProfilerBars(c *ui.Context, text string, root Span, o ProfilerBarsOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
w := pixel.Or("ProfilerBars Width", o.Width, 240)
|
||||
if root.Length <= 0 {
|
||||
|
||||
@@ -27,7 +27,7 @@ type seen struct {
|
||||
const flags = "NV-BDIZC"
|
||||
|
||||
// RegisterView shows registers and flags; the last change lights.
|
||||
func RegisterView(c *ui.Context, text string, cpu CPU, o RegisterViewOptions) *ui.Element {
|
||||
func RegisterView(c *ui.Context, text string, cpu CPU, o RegisterViewOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
col := ui.Column(c).Gap(k.D(1)).Role(ui.RoleGroup).Label(text)
|
||||
sn := ui.Local(col, regKey{}, func() seen { return seen{cpu: cpu} })
|
||||
|
||||
@@ -22,7 +22,7 @@ type ShortcutListOptions struct {
|
||||
}
|
||||
|
||||
// ShortcutList pairs actions with their keycaps.
|
||||
func ShortcutList(c *ui.Context, label string, items []Shortcut, o ShortcutListOptions) *ui.Element {
|
||||
func ShortcutList(c *ui.Context, label string, items []Shortcut, o ShortcutListOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
for _, it := range items {
|
||||
if len(it.Keys) == 0 {
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ type SpriteSheetOptions struct {
|
||||
}
|
||||
|
||||
type SpriteSheetResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Changed is a frame chosen or play pressed.
|
||||
Changed bool
|
||||
}
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ type TerminalOptions struct {
|
||||
}
|
||||
|
||||
type TerminalResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Ran is the command Enter sent, else "".
|
||||
Ran string
|
||||
Changed bool
|
||||
|
||||
Reference in new issue
Block a user