mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
text: move Label.it to a local variable
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+2
-4
@@ -33,8 +33,6 @@ type Label struct {
|
|||||||
Text string
|
Text string
|
||||||
// MaxLines limits the number of lines. Zero means no limit.
|
// MaxLines limits the number of lines. Zero means no limit.
|
||||||
MaxLines int
|
MaxLines int
|
||||||
|
|
||||||
it lineIterator
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type lineIterator struct {
|
type lineIterator struct {
|
||||||
@@ -110,14 +108,14 @@ func (l Label) Layout(gtx *layout.Context, family Family) {
|
|||||||
Min: image.Point{X: -inf, Y: -padTop},
|
Min: image.Point{X: -inf, Y: -padTop},
|
||||||
Max: image.Point{X: inf, Y: dims.Size.Y + padBottom},
|
Max: image.Point{X: inf, Y: dims.Size.Y + padBottom},
|
||||||
}
|
}
|
||||||
l.it = lineIterator{
|
it := lineIterator{
|
||||||
Lines: lines,
|
Lines: lines,
|
||||||
Clip: clip,
|
Clip: clip,
|
||||||
Alignment: l.Alignment,
|
Alignment: l.Alignment,
|
||||||
Width: dims.Size.X,
|
Width: dims.Size.X,
|
||||||
}
|
}
|
||||||
for {
|
for {
|
||||||
str, off, ok := l.it.Next()
|
str, off, ok := it.Next()
|
||||||
if !ok {
|
if !ok {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user