@@ -484,8 +484,8 @@ class ZRText extends Displayable<TextProps> implements GroupLike {
484484 const needDrawBg = needDrawBackground ( style ) ;
485485 const bgColorDrawn = ! ! ( style . backgroundColor ) ;
486486
487- // outerWidth is the real text width containing padding.
488487 const outerHeight = contentBlock . outerHeight ;
488+ const outerWidth = contentBlock . outerWidth ;
489489 const contentWidth = contentBlock . contentWidth ;
490490
491491 const textLines = contentBlock . lines ;
@@ -503,10 +503,9 @@ class ZRText extends Displayable<TextProps> implements GroupLike {
503503
504504 if ( needDrawBg || textPadding ) {
505505 // Consider performance, do not call getTextWidth util necessary.
506- const boxX = adjustTextX ( baseX , contentWidth , textAlign ) ;
506+ const boxX = adjustTextX ( baseX , outerWidth , textAlign ) ;
507507 const boxY = adjustTextY ( baseY , outerHeight , verticalAlign ) ;
508-
509- needDrawBg && this . _renderBackground ( style , style , boxX , boxY , contentWidth , outerHeight ) ;
508+ needDrawBg && this . _renderBackground ( style , style , boxX , boxY , outerWidth , outerHeight ) ;
510509 }
511510
512511 // `textBaseline` is set as 'middle'.
@@ -605,7 +604,7 @@ class ZRText extends Displayable<TextProps> implements GroupLike {
605604 * Otherwise, there will be extra space in the
606605 * bounding rect calculated.
607606 */
608- innerWidth ,
607+ contentWidth ,
609608 calculatedLineHeight
610609 ) ) ;
611610 }
0 commit comments