mirror of https://github.com/buggins/dlangui.git
TextWidget/MultilineTextWidget fix multiline when maxWidth is set.
This commit is contained in:
parent
3bfcc1e253
commit
b8c669f9d9
|
@ -119,8 +119,15 @@ class TextWidget : Widget {
|
||||||
|
|
||||||
override void measure(int parentWidth, int parentHeight) {
|
override void measure(int parentWidth, int parentHeight) {
|
||||||
FontRef font = font();
|
FontRef font = font();
|
||||||
uint w = (maxLines == 1) ? MAX_WIDTH_UNSPECIFIED :
|
|
||||||
parentWidth - margins.left - margins.right - padding.left - padding.right;
|
uint w;
|
||||||
|
if (maxLines == 1)
|
||||||
|
w = MAX_WIDTH_UNSPECIFIED;
|
||||||
|
else {
|
||||||
|
w = parentWidth - margins.left - margins.right - padding.left - padding.right;
|
||||||
|
if (maxWidth > 0 && maxWidth < w)
|
||||||
|
w = maxWidth - padding.left - padding.right;
|
||||||
|
}
|
||||||
uint flags = textFlags;
|
uint flags = textFlags;
|
||||||
|
|
||||||
// optimization: do not measure if nothing changed
|
// optimization: do not measure if nothing changed
|
||||||
|
|
Loading…
Reference in New Issue