mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-03 00:16:15 +00:00
widget: add semantic descriptions
Some semantic information is automatically extracted, but some must be provided by UI components. This change enriches the generic and material widgets with such information. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"image"
|
||||
"unicode/utf8"
|
||||
|
||||
"gioui.org/io/semantic"
|
||||
"gioui.org/layout"
|
||||
"gioui.org/op"
|
||||
"gioui.org/op/clip"
|
||||
@@ -184,6 +185,8 @@ func (l Label) Layout(gtx layout.Context, s text.Shaper, font text.Font, size un
|
||||
rcl.Pop()
|
||||
t.Pop()
|
||||
}
|
||||
defer clip.Rect(image.Rectangle{Max: dims.Size}).Push(gtx.Ops).Pop()
|
||||
semantic.LabelOp(txt).Add(gtx.Ops)
|
||||
return dims
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user