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>
39 lines
951 B
Go
39 lines
951 B
Go
package text
|
|
|
|
import (
|
|
"github.com/egoist/mygo/ui"
|
|
|
|
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
|
)
|
|
|
|
var quoteMark = pixel.MustSprite(`
|
|
.##..##.
|
|
#...#...
|
|
##..##..
|
|
##..##..
|
|
`)
|
|
|
|
type QuoteOptions struct {
|
|
Cite string
|
|
}
|
|
|
|
// Quote is a block quote with bar, mark and cite.
|
|
func Quote(c *ui.Context, s string, o QuoteOptions) ui.Element {
|
|
k := pixel.K(c)
|
|
return ui.Row(c).Gap(k.D(6)).AlignItems(ui.Stretch).Role(ui.RoleGroup).Children(func() {
|
|
ui.Box(c).Width(k.D(2)).Draw(func(p *ui.Painter, r ui.Rect) {
|
|
g := k.Canvas(p, r)
|
|
g.Rect(0, 0, g.W, g.H, pixel.Accent)
|
|
})
|
|
ui.Column(c).Grow(1).Gap(k.D(2)).Children(func() {
|
|
ui.Box(c).Size(k.D(quoteMark.W), k.D(quoteMark.H)).Draw(func(p *ui.Painter, r ui.Rect) {
|
|
k.Canvas(p, r).Sprite(0, 0, quoteMark, 0, pixel.Accent, 1)
|
|
})
|
|
Paragraph(c, s, ParagraphOptions{})
|
|
if o.Cite != "" {
|
|
pixel.Text(c, "— "+o.Cite, pixel.TextOptions{Slot: pixel.Faint})
|
|
}
|
|
})
|
|
})
|
|
}
|