mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
widget{,/material}: [API] split interactive and non-interactive text widgets
This commit separates the types for interactive and non-interactive text within package widget. widget.Selectable is used for all interactive text. widget.Label is used for all non-interactive text. There is no longer a field on widget.Label to provide it with a Selectable. If you want selectable text and are not relying upon the material pacakge API, you need to create widget.Selectables instead of widget.Labels. The material package's LabelStyle API is unchanged. Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
@@ -97,7 +97,7 @@ func BenchmarkLabelStatic(b *testing.B) {
|
||||
l := Label{}
|
||||
b.ResetTimer()
|
||||
for i := 0; i < b.N; i++ {
|
||||
l.Layout(gtx, cache, font, fontSize, runesStr, op.CallOp{}, op.CallOp{})
|
||||
l.Layout(gtx, cache, font, fontSize, runesStr, op.CallOp{})
|
||||
if render {
|
||||
win.Frame(gtx.Ops)
|
||||
}
|
||||
@@ -132,7 +132,7 @@ func BenchmarkLabelDynamic(b *testing.B) {
|
||||
a := rand.Intn(len(runes))
|
||||
b := rand.Intn(len(runes))
|
||||
runes[a], runes[b] = runes[b], runes[a]
|
||||
l.Layout(gtx, cache, font, fontSize, string(runes), op.CallOp{}, op.CallOp{})
|
||||
l.Layout(gtx, cache, font, fontSize, string(runes), op.CallOp{})
|
||||
if render {
|
||||
win.Frame(gtx.Ops)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user