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
@@ -24,7 +24,7 @@ type AudioPlayerOptions struct {
|
||||
}
|
||||
|
||||
type AudioPlayerResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Changed is play, seek or volume; others are presses.
|
||||
Changed, Stopped, Previous, Next bool
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ type CartridgeOptions struct {
|
||||
}
|
||||
|
||||
// Cartridge is a game cart with a sticker: art, title.
|
||||
func Cartridge(c *ui.Context, text string, o CartridgeOptions) *ui.Element {
|
||||
func Cartridge(c *ui.Context, text string, o CartridgeOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if o.Art != nil && (o.Art.W > 38 || o.Art.H > 22) {
|
||||
panic("media: Cartridge Art is larger than 38 by 22")
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ type CassetteOptions struct {
|
||||
}
|
||||
|
||||
// Cassette turns its reels while playing; tape winds right.
|
||||
func Cassette(c *ui.Context, text string, o CassetteOptions) *ui.Element {
|
||||
func Cassette(c *ui.Context, text string, o CassetteOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if !(o.Progress >= 0 && o.Progress <= 1) {
|
||||
panic(fmt.Sprintf("media: Cassette Progress %v outside 0–1", o.Progress))
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ type EqualizerOptions struct {
|
||||
}
|
||||
|
||||
type EqualizerResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Band is the band changed this frame, else -1.
|
||||
Band int
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ type FilmstripOptions struct {
|
||||
}
|
||||
|
||||
// Filmstrip lays a sprite's frames on film with sprocket holes.
|
||||
func Filmstrip(c *ui.Context, text string, sp *pixel.Sprite, o FilmstripOptions) *ui.Element {
|
||||
func Filmstrip(c *ui.Context, text string, sp *pixel.Sprite, o FilmstripOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
s := scale("Filmstrip", o.Scale, 2)
|
||||
n := sp.Frames()
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ type GalleryOptions struct {
|
||||
}
|
||||
|
||||
type GalleryResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ type ImageCompareOptions struct {
|
||||
}
|
||||
|
||||
type ImageCompareResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -39,7 +39,7 @@ func scale(name string, s, def int) int {
|
||||
}
|
||||
|
||||
// art is a named picture w by h dots.
|
||||
func art(c *ui.Context, k pixel.Kit, label string, w, h int) *ui.Element {
|
||||
func art(c *ui.Context, k pixel.Kit, label string, w, h int) ui.Element {
|
||||
if label == "" {
|
||||
panic("media: a picture needs a name")
|
||||
}
|
||||
@@ -75,7 +75,7 @@ type turn struct {
|
||||
}
|
||||
|
||||
// turned counts steps while playing; stopped, it holds still.
|
||||
func turned(c *ui.Context, k pixel.Kit, e *ui.Element, playing bool, fps int) int {
|
||||
func turned(c *ui.Context, k pixel.Kit, e ui.Element, playing bool, fps int) int {
|
||||
s := ui.Local(e, turnKey{}, func() turn { return turn{} })
|
||||
on := playing && !k.Reduce()
|
||||
if on {
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ func note(semi int) string {
|
||||
}
|
||||
|
||||
// played are the semitones whose letters e heard this frame.
|
||||
func played(e *ui.Element) []int {
|
||||
func played(e ui.Element) []int {
|
||||
var out []int
|
||||
for semi, kb := range keyboard {
|
||||
if pixel.Shortcut(e, 0, kb.key) {
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@ type PianoKeysOptions struct {
|
||||
}
|
||||
|
||||
type PianoKeysResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Struck are notes begun this frame, like "C#4".
|
||||
Struck []string
|
||||
}
|
||||
@@ -36,7 +36,7 @@ var (
|
||||
// PianoKeys plays C4–C5 by pointer, A–K and WETYU.
|
||||
func PianoKeys(c *ui.Context, text string, o PianoKeysOptions) PianoKeysResult {
|
||||
k := pixel.K(c)
|
||||
shell, base, st := pixel.Shell(c, func() *ui.Element {
|
||||
shell, base, st := pixel.Shell(c, func() ui.Element {
|
||||
return ui.Box(c).Focusable().Role(ui.RoleGroup).Label(text).Disabled(o.Disabled)
|
||||
})
|
||||
hd := ui.Local(base, pianoKey{}, func() hand { return hand{held: -1, typed: -1} })
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ type PlaylistOptions struct {
|
||||
}
|
||||
|
||||
type PlaylistResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Submitted is Enter or a double click on a row.
|
||||
Changed, Submitted bool
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ type RecordButtonOptions struct {
|
||||
}
|
||||
|
||||
type RecordButtonResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ type ScrubberOptions struct {
|
||||
}
|
||||
|
||||
type ScrubberResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ type StepSequencerOptions struct {
|
||||
}
|
||||
|
||||
type StepSequencerResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
// Step is the playhead, 0–15, or -1 when stopped.
|
||||
Step int
|
||||
|
||||
+1
-1
@@ -23,7 +23,7 @@ type TrackerOptions struct {
|
||||
}
|
||||
|
||||
type TrackerResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ type TransportOptions struct {
|
||||
}
|
||||
|
||||
type TransportResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Changed is play or pause; the rest are presses.
|
||||
Changed, Stopped, Previous, Next bool
|
||||
}
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ type TunerOptions struct {
|
||||
}
|
||||
|
||||
type TunerResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -19,7 +19,7 @@ type VideoFrameOptions struct {
|
||||
}
|
||||
|
||||
type VideoFrameResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
// Changed is play, pause or a seek.
|
||||
Changed bool
|
||||
}
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ type VinylOptions struct {
|
||||
}
|
||||
|
||||
// Vinyl turns a record while playing; the arm swings on.
|
||||
func Vinyl(c *ui.Context, text string, o VinylOptions) *ui.Element {
|
||||
func Vinyl(c *ui.Context, text string, o VinylOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
e := art(c, k, text, 72, 64)
|
||||
swing := float64(k.Toward(c, e, o.Playing, 12, 6)) / 6
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ type VisualizerOptions struct {
|
||||
}
|
||||
|
||||
// Visualizer mirrors each level, 0 to 1, about the middle.
|
||||
func Visualizer(c *ui.Context, text string, levels []float64, o VisualizerOptions) *ui.Element {
|
||||
func Visualizer(c *ui.Context, text string, levels []float64, o VisualizerOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if len(levels) == 0 {
|
||||
panic("media: Visualizer has no levels")
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ type VolumeOptions struct {
|
||||
}
|
||||
|
||||
type VolumeResult struct {
|
||||
Element *ui.Element
|
||||
Element ui.Element
|
||||
Changed bool
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ type WaveformOptions struct {
|
||||
}
|
||||
|
||||
// Waveform draws samples, ±1, as lines from the middle.
|
||||
func Waveform(c *ui.Context, text string, samples []float64, o WaveformOptions) *ui.Element {
|
||||
func Waveform(c *ui.Context, text string, samples []float64, o WaveformOptions) ui.Element {
|
||||
k := pixel.K(c)
|
||||
if len(samples) == 0 {
|
||||
panic("media: Waveform has no samples")
|
||||
|
||||
Reference in new issue
Block a user