Add chat components 321-345; named List rows, inert scroll views
Speech bubbles, a chat log that follows its end, a composer that sends on Enter, typing dots, chat and channel lists, read receipts, reactions, emoji and sticker pickers, mentions, date and unread rules, system lines, member lists, user cards, a mailbox, mail reader and letter, a notification bell, call controls, a voice meter, attachment chips, link previews and polls. pixel's editor takes EnterSends; display's Bubble takes a Fill and exports EmojiSprite. data.List names its rows, which also lets typing choose one. layout.ScrollArea and input.TextArea hold still under Inert, and an inert scroll view leaves the Tab order until it wakes.
This commit is contained in:
50 files changed
+2697
-34
No files matched your search
+8
-6
@@ -22,6 +22,8 @@ type BubbleOptions struct {
|
||||
Tail Side
|
||||
// At offsets the tail along its side; zero means 8.
|
||||
At int
|
||||
// Fill is the bubble's slot; zero means Lit.
|
||||
Fill pixel.Slot
|
||||
}
|
||||
|
||||
const tailLen = 5
|
||||
@@ -32,7 +34,7 @@ func Bubble(c *ui.Context, o BubbleOptions, children func()) *ui.Element {
|
||||
panic(fmt.Sprintf("display: unknown Side %d", o.Tail))
|
||||
}
|
||||
k := pixel.K(c)
|
||||
at := pixel.Or("Bubble At", o.At, 8)
|
||||
at, fill := pixel.Or("Bubble At", o.At, 8), slotOr(o.Fill, pixel.Lit)
|
||||
pad := [4]int{6, 8, 6, 8}
|
||||
pad[[...]int{Bottom: 2, Top: 0, Left: 3, Right: 1}[o.Tail]] += tailLen
|
||||
return ui.Column(c).Padding(k.D(pad[0]), k.D(pad[1]), k.D(pad[2]), k.D(pad[3])).Draw(func(p *ui.Painter, r ui.Rect) {
|
||||
@@ -51,22 +53,22 @@ func Bubble(c *ui.Context, o BubbleOptions, children func()) *ui.Element {
|
||||
if w < 6 || h < 6 {
|
||||
return
|
||||
}
|
||||
g.Frame(x, y, w, h, pixel.Notched, pixel.Lit)
|
||||
g.Frame(x, y, w, h, pixel.Notched, fill)
|
||||
for i := range tailLen {
|
||||
n := tailLen - i
|
||||
switch o.Tail {
|
||||
case Bottom:
|
||||
g.HLine(x+at-1, y+h-1+i, n+1, pixel.Edge)
|
||||
g.HLine(x+at, y+h-1+i, n-1, pixel.Lit)
|
||||
g.HLine(x+at, y+h-1+i, n-1, fill)
|
||||
case Top:
|
||||
g.HLine(x+at-1, y-i, n+1, pixel.Edge)
|
||||
g.HLine(x+at, y-i, n-1, pixel.Lit)
|
||||
g.HLine(x+at, y-i, n-1, fill)
|
||||
case Left:
|
||||
g.VLine(x-i, y+at-1, n+1, pixel.Edge)
|
||||
g.VLine(x-i, y+at, n-1, pixel.Lit)
|
||||
g.VLine(x-i, y+at, n-1, fill)
|
||||
case Right:
|
||||
g.VLine(x+w-1+i, y+at-1, n+1, pixel.Edge)
|
||||
g.VLine(x+w-1+i, y+at, n-1, pixel.Lit)
|
||||
g.VLine(x+w-1+i, y+at, n-1, fill)
|
||||
}
|
||||
}
|
||||
}).Children(children)
|
||||
|
||||
Reference in new issue
Block a user