TextWidget/MultilineTextWidget: _measureSaver should also check maxLines

This commit is contained in:
and3md 2017-11-29 10:44:12 +01:00
parent b8c669f9d9
commit bfd373a368
1 changed files with 2 additions and 2 deletions

View File

@ -115,7 +115,7 @@ class TextWidget : Widget {
return this; return this;
} }
private CalcSaver!(Font, dstring, uint, uint) _measureSaver; private CalcSaver!(Font, dstring, uint, uint, int) _measureSaver;
override void measure(int parentWidth, int parentHeight) { override void measure(int parentWidth, int parentHeight) {
FontRef font = font(); FontRef font = font();
@ -131,7 +131,7 @@ class TextWidget : Widget {
uint flags = textFlags; uint flags = textFlags;
// optimization: do not measure if nothing changed // optimization: do not measure if nothing changed
if (_measureSaver.check(font.get, text, w, flags) || _needLayout) { if (_measureSaver.check(font.get, text, w, flags, maxLines) || _needLayout) {
Point sz; Point sz;
if (maxLines == 1) { if (maxLines == 1) {
sz = font.textSize(text, w, 4, 0, flags); sz = font.textSize(text, w, 4, 0, flags);