text: move Label.it to a local variable

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-10-06 12:29:35 +02:00
parent 43131b6f57
commit 225c73f012
+2 -4
View File
@@ -33,8 +33,6 @@ type Label struct {
Text string
// MaxLines limits the number of lines. Zero means no limit.
MaxLines int
it lineIterator
}
type lineIterator struct {
@@ -110,14 +108,14 @@ func (l Label) Layout(gtx *layout.Context, family Family) {
Min: image.Point{X: -inf, Y: -padTop},
Max: image.Point{X: inf, Y: dims.Size.Y + padBottom},
}
l.it = lineIterator{
it := lineIterator{
Lines: lines,
Clip: clip,
Alignment: l.Alignment,
Width: dims.Size.X,
}
for {
str, off, ok := l.it.Next()
str, off, ok := it.Next()
if !ok {
break
}