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
+5
-2
@@ -16,6 +16,8 @@ type TextAreaOptions struct {
|
||||
// Width is zero for 160 dots, Lines zero for 4.
|
||||
Width, Lines int
|
||||
Disabled bool
|
||||
// EnterSends submits on Enter; Shift+Enter breaks lines.
|
||||
EnterSends bool
|
||||
}
|
||||
|
||||
type areaKey struct{}
|
||||
@@ -36,7 +38,8 @@ func TextArea(c *ui.Context, text string, value *string, o TextAreaOptions) Text
|
||||
lines := pixel.Or("TextArea Lines", o.Lines, 4)
|
||||
col := ui.Column(c).Width(k.D(pixel.Or("TextArea Width", o.Width, 160))).Gap(k.D(2))
|
||||
st := ui.Local(col, areaKey{}, func() areaState { return areaState{line: -1} })
|
||||
if o.Disabled {
|
||||
// Disabled or inert, the view holds still.
|
||||
if o.Disabled || pixel.Current(c).Inert {
|
||||
st.scroll.Y = st.held
|
||||
}
|
||||
var ed pixel.Edit
|
||||
@@ -46,7 +49,7 @@ func TextArea(c *ui.Context, text string, value *string, o TextAreaOptions) Text
|
||||
g := k.Canvas(p, r)
|
||||
g.Frame(0, 0, g.W, g.H, pixel.Sunken, pixel.Well)
|
||||
}).Children(func() {
|
||||
ed = pixel.Editor(c, value, pixel.EditorOptions{Multiline: true, Label: text, Placeholder: o.Placeholder, MaxLength: o.MaxLength, Disabled: o.Disabled})
|
||||
ed = pixel.Editor(c, value, pixel.EditorOptions{Multiline: true, Label: text, Placeholder: o.Placeholder, MaxLength: o.MaxLength, Disabled: o.Disabled, EnterSends: o.EnterSends})
|
||||
})
|
||||
// Keep the caret's line in view after it moves.
|
||||
if ed.Line != st.line || *value != st.text {
|
||||
|
||||
Reference in new issue
Block a user