Add feedback components 106-130; inert scope, focus return, two-step deploy
This commit is contained in:
87 files changed
+2492
-147
No files matched your search
+1
-12
@@ -16,20 +16,9 @@ func block(c *ui.Context, k pixel.Kit, s string, w, h int, fn func(g pixel.Canva
|
||||
})
|
||||
}
|
||||
|
||||
// orDef is v, or def for zero; negative panics.
|
||||
func orDef(name string, v, def int) int {
|
||||
if v < 0 {
|
||||
panic(fmt.Sprintf("text: %s %d is negative", name, v))
|
||||
}
|
||||
if v == 0 {
|
||||
return def
|
||||
}
|
||||
return v
|
||||
}
|
||||
|
||||
// scale is s, or 1 for zero; outside 1–4 panics.
|
||||
func scale(s int) int {
|
||||
s = orDef("Scale", s, 1)
|
||||
s = pixel.Or("Scale", s, 1)
|
||||
if s > 4 {
|
||||
panic(fmt.Sprintf("text: Scale %d outside 1–4", s))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user