@@ -1102,7 +1102,7 @@ public virtual string Text {
1102
1102
_text = EnableNeedsFormat ( value ) ;
1103
1103
1104
1104
if ( ( AutoSize && Alignment != TextAlignment . Justified && VerticalAlignment != VerticalTextAlignment . Justified ) || ( textWasNull && Size . IsEmpty ) ) {
1105
- Size = CalcRect ( 0 , 0 , _text , _textDirection , TabWidth ) . Size ;
1105
+ Size = CalcRect ( 0 , 0 , _text , Direction , TabWidth ) . Size ;
1106
1106
}
1107
1107
1108
1108
//if (_text != null && _text.GetRuneCount () > 0 && (Size.Width == 0 || Size.Height == 0 || Size.Width != _text.GetColumns ())) {
@@ -1129,7 +1129,7 @@ public bool AutoSize {
1129
1129
set {
1130
1130
_autoSize = EnableNeedsFormat ( value ) ;
1131
1131
if ( _autoSize && Alignment != TextAlignment . Justified && VerticalAlignment != VerticalTextAlignment . Justified ) {
1132
- Size = CalcRect ( 0 , 0 , Text , _textDirection , TabWidth ) . Size ;
1132
+ Size = CalcRect ( 0 , 0 , _text , Direction , TabWidth ) . Size ;
1133
1133
}
1134
1134
}
1135
1135
}
@@ -1169,7 +1169,12 @@ public VerticalTextAlignment VerticalAlignment {
1169
1169
/// <value>The text vertical alignment.</value>
1170
1170
public TextDirection Direction {
1171
1171
get => _textDirection ;
1172
- set => _textDirection = EnableNeedsFormat ( value ) ;
1172
+ set {
1173
+ _textDirection = EnableNeedsFormat ( value ) ;
1174
+ if ( AutoSize && Alignment != TextAlignment . Justified && VerticalAlignment != VerticalTextAlignment . Justified ) {
1175
+ Size = CalcRect ( 0 , 0 , Text , Direction , TabWidth ) . Size ;
1176
+ }
1177
+ }
1173
1178
}
1174
1179
1175
1180
/// <summary>
@@ -1250,7 +1255,7 @@ public Size Size {
1250
1255
get => _size ;
1251
1256
set {
1252
1257
if ( AutoSize && Alignment != TextAlignment . Justified && VerticalAlignment != VerticalTextAlignment . Justified ) {
1253
- _size = EnableNeedsFormat ( CalcRect ( 0 , 0 , Text , _textDirection , TabWidth ) . Size ) ;
1258
+ _size = EnableNeedsFormat ( CalcRect ( 0 , 0 , Text , Direction , TabWidth ) . Size ) ;
1254
1259
} else {
1255
1260
_size = EnableNeedsFormat ( value ) ;
1256
1261
}
@@ -1329,7 +1334,7 @@ public List<string> Lines {
1329
1334
shown_text = ReplaceHotKeyWithTag ( shown_text , _hotKeyPos ) ;
1330
1335
}
1331
1336
1332
- if ( IsVerticalDirection ( _textDirection ) ) {
1337
+ if ( IsVerticalDirection ( Direction ) ) {
1333
1338
var colsWidth = GetSumMaxCharWidth ( shown_text , 0 , 1 , TabWidth ) ;
1334
1339
_lines = Format ( shown_text , Size . Height , VerticalAlignment == VerticalTextAlignment . Justified , Size . Width > colsWidth && WordWrap ,
1335
1340
PreserveTrailingSpaces , TabWidth , Direction , MultiLine ) ;
@@ -1434,7 +1439,7 @@ public void Draw (Rect bounds, Attribute normalColor, Attribute hotColor, Rect c
1434
1439
// Use "Lines" to ensure a Format (don't use "lines"))
1435
1440
1436
1441
var linesFormated = Lines ;
1437
- switch ( _textDirection ) {
1442
+ switch ( Direction ) {
1438
1443
case TextDirection . TopBottom_RightLeft :
1439
1444
case TextDirection . LeftRight_BottomTop :
1440
1445
case TextDirection . RightLeft_BottomTop :
@@ -1443,7 +1448,7 @@ public void Draw (Rect bounds, Attribute normalColor, Attribute hotColor, Rect c
1443
1448
break ;
1444
1449
}
1445
1450
1446
- var isVertical = IsVerticalDirection ( _textDirection ) ;
1451
+ var isVertical = IsVerticalDirection ( Direction ) ;
1447
1452
var maxBounds = bounds ;
1448
1453
if ( driver != null ) {
1449
1454
maxBounds = containerBounds == default
@@ -1475,7 +1480,7 @@ public void Draw (Rect bounds, Attribute normalColor, Attribute hotColor, Rect c
1475
1480
1476
1481
var runes = _lines [ line ] . ToRunes ( ) ;
1477
1482
1478
- switch ( _textDirection ) {
1483
+ switch ( Direction ) {
1479
1484
case TextDirection . RightLeft_BottomTop :
1480
1485
case TextDirection . RightLeft_TopBottom :
1481
1486
case TextDirection . BottomTop_LeftRight :
@@ -1488,7 +1493,7 @@ public void Draw (Rect bounds, Attribute normalColor, Attribute hotColor, Rect c
1488
1493
1489
1494
int x , y ;
1490
1495
// Horizontal Alignment
1491
- if ( _textAlignment == TextAlignment . Right || ( _textAlignment == TextAlignment . Justified && ! IsLeftToRight ( _textDirection ) ) ) {
1496
+ if ( _textAlignment == TextAlignment . Right || ( _textAlignment == TextAlignment . Justified && ! IsLeftToRight ( Direction ) ) ) {
1492
1497
if ( isVertical ) {
1493
1498
var runesWidth = GetSumMaxCharWidth ( Lines , line , TabWidth ) ;
1494
1499
x = bounds . Right - runesWidth ;
@@ -1521,7 +1526,7 @@ public void Draw (Rect bounds, Attribute normalColor, Attribute hotColor, Rect c
1521
1526
}
1522
1527
1523
1528
// Vertical Alignment
1524
- if ( _textVerticalAlignment == VerticalTextAlignment . Bottom || ( _textVerticalAlignment == VerticalTextAlignment . Justified && ! IsTopToBottom ( _textDirection ) ) ) {
1529
+ if ( _textVerticalAlignment == VerticalTextAlignment . Bottom || ( _textVerticalAlignment == VerticalTextAlignment . Justified && ! IsTopToBottom ( Direction ) ) ) {
1525
1530
if ( isVertical ) {
1526
1531
y = bounds . Bottom - runes . Length ;
1527
1532
} else {
0 commit comments