ui/text: add LayoutOptions

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-06-30 23:58:05 +02:00
parent 28f53d8708
commit 0546683720
4 changed files with 22 additions and 19 deletions
+1 -1
View File
@@ -81,7 +81,7 @@ func (l *lineIterator) Next() (String, f32.Point, bool) {
}
func (l Label) Layout(ops *ui.Ops, cs layout.Constraints) layout.Dimens {
textLayout := l.Face.Layout(l.Text, false, cs.Width.Max)
textLayout := l.Face.Layout(l.Text, LayoutOptions{MaxWidth: cs.Width.Max})
lines := textLayout.Lines
if max := l.MaxLines; max > 0 && len(lines) > max {
lines = lines[:max]