File tree Expand file tree Collapse file tree
src/gameobjects/text/static Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1118,13 +1118,20 @@ var Text = new Class({
11181118
11191119 var padding = this . padding ;
11201120
1121+ var textWidth ;
1122+
11211123 if ( style . fixedWidth === 0 )
11221124 {
11231125 this . width = textSize . width + padding . left + padding . right ;
1126+ textWidth = textSize . width ;
11241127 }
11251128 else
11261129 {
11271130 this . width = style . fixedWidth ;
1131+ textWidth = this . width - padding . left - padding . right ;
1132+ if ( textWidth < textSize . width ) {
1133+ textWidth = textSize . width ;
1134+ }
11281135 }
11291136
11301137 if ( style . fixedHeight === 0 )
@@ -1198,11 +1205,11 @@ var Text = new Class({
11981205 }
11991206 else if ( style . align === 'right' )
12001207 {
1201- linePositionX += textSize . width - textSize . lineWidths [ i ] ;
1208+ linePositionX += textWidth - textSize . lineWidths [ i ] ;
12021209 }
12031210 else if ( style . align === 'center' )
12041211 {
1205- linePositionX += ( textSize . width - textSize . lineWidths [ i ] ) / 2 ;
1212+ linePositionX += ( textWidth - textSize . lineWidths [ i ] ) / 2 ;
12061213 }
12071214
12081215 if ( this . autoRound )
You can’t perform that action at this time.
0 commit comments