Module reaction_strip
Expand description
The reaction strip: one pill per emoji people reacted with, its count beside it, and a trailing button to add one.
Everything that takes reactions ([tilo_resource::Reactions]) shows them with this strip, so a
reaction reads the same under a chat message, on a page and in a window’s toolbar. Your own
reaction is the chosen pill (the accent washed in, with an accent edge); a workspace emoji
(:name:) is drawn as its picture from crate::workspace_emoji and as its :name: while
the picture is not there. Pointing at a pill names who reacted. A pill arriving appears from its
centre and a count changing cross-fades (motion::Appear, motion::CrossFade), both only once
the strip is on screen and as reduced motion allows.
Two ways in: by hand, ReactionStrip keeps one strip’s motion and lays the pills out from
an origin within a width (ReactionStrip::layout, then ReactionStrip::paint, hit,
tooltip_at, accessibility; measure_height sizes a row first); retained,
ReactionStripWidget places like any widget, reports a toggle as ReactionToggle and opens
the shared emoji picker from its add button.
Structs§
- Reaction
Strip - One strip’s pills and how they move: what a host keeps per strip it paints (a message’s reactions), so a reaction arriving appears and a count changing cross-fades.
- Reaction
Strip Widget - The reactions to one thing, as a widget: pills that toggle your own reaction, and an add button that asks for another emoji.
- Reaction
Toggle - A person reacting with an emoji (
react), or taking their reaction back: what a pill or a pick in the picker asks for. - Strip
Layout - The pills and the add button of one strip, laid out.
- Strip
Metrics - A strip’s geometry in one theme: everything the text scale moves.
- Strip
Pill - One laid-out pill.
Enums§
- Strip
Hit - What a point on the strip is.
Functions§
- layout
- Lay out
groupsfromorigin, wrapping atmax_width: one pill per group, then the add button whencan_react. - measure_
height - How tall the strip of
groupsis withinmax_width: nothing when there is nothing to show. - paint_
emoji - Draw
emojiinrect: a workspace emoji’s picture, its:name:instyleandinkwhile it has none, or the Unicode emoji centred and sized to the rect. - pill_
count - A pill’s accessible value: how many reacted with its emoji.
- pill_
name - A pill’s accessible name: what pressing it does.