Documentation ¶
Overview ¶
Package richtext provides rendering of text containing multiple fonts, styles, and levels of interactivity.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var LongPressDuration time.Duration = 250 * time.Millisecond
LongPressDuration is the default duration of a long press gesture. Override this variable to change the detection threshold.
Functions ¶
This section is empty.
Types ¶
type Event ¶
type Event struct { Type EventType // ClickData is only populated if Type == Clicked ClickData gesture.ClickEvent }
Event describes an interaction with rich text.
type InteractiveSpan ¶
type InteractiveSpan struct {
// contains filtered or unexported fields
}
InteractiveSpan holds the persistent state of rich text that can be interacted with by the user. It can report clicks, hovers, and long-presses on the text.
func (*InteractiveSpan) Content ¶
func (i *InteractiveSpan) Content() (string, map[string]interface{})
Content returns the text content of the interactive span as well as the metadata associated with it.
func (*InteractiveSpan) Events ¶
func (i *InteractiveSpan) Events() []Event
Events returns click event information for this span.
func (*InteractiveSpan) Get ¶
func (i *InteractiveSpan) Get(key string) interface{}
Get looks up a metadata property on the interactive span.
func (*InteractiveSpan) Layout ¶
func (i *InteractiveSpan) Layout(gtx layout.Context) layout.Dimensions
Layout adds the pointer input op for this interactive span and updates its state. It uses the most recent pointer.AreaOp as its input area.
type InteractiveText ¶
type InteractiveText struct {
Spans []InteractiveSpan
}
InteractiveText holds persistent state for a block of text containing spans that may be interactive.
func (*InteractiveText) Events ¶
func (i *InteractiveText) Events() (*InteractiveSpan, []Event)
Events returns the first span with unprocessed events and the events that need processing for it.
type SpanStyle ¶
type SpanStyle struct { Font text.Font Size unit.Sp Color color.NRGBA Content string Interactive bool Img image.Image // contains filtered or unexported fields }
SpanStyle describes the appearance of a span of styled text.