@@ -415,6 +415,8 @@ function drawTexts(g, gd, maxLength) {
415415 . call ( Drawing . font , fullLayout . legend . font )
416416 . text ( isEditable ? ensureLength ( name , maxLength ) : name ) ;
417417
418+ svgTextUtils . positionText ( textEl , constants . textOffsetX , 0 ) ;
419+
418420 function textLayout ( s ) {
419421 svgTextUtils . convertToTspans ( s , gd , function ( ) {
420422 computeTextDimensions ( g , gd ) ;
@@ -520,7 +522,7 @@ function computeTextDimensions(g, gd) {
520522 height = mathjaxBB . height ;
521523 width = mathjaxBB . width ;
522524
523- Drawing . setTranslate ( mathjaxGroup , 40 , ( height / 4 ) ) ;
525+ Drawing . setTranslate ( mathjaxGroup , 0 , ( height / 4 ) ) ;
524526 }
525527 else {
526528 var text = g . select ( '.legendtext' ) ;
@@ -533,9 +535,7 @@ function computeTextDimensions(g, gd) {
533535 // approximation to height offset to center the font
534536 // to avoid getBoundingClientRect
535537 var textY = lineHeight * ( 0.3 + ( 1 - textLines ) / 2 ) ;
536- // TODO: this 40 should go in a constants file (along with other
537- // values related to the legend symbol size)
538- svgTextUtils . positionText ( text , 40 , textY ) ;
538+ svgTextUtils . positionText ( text , constants . textOffsetX , textY ) ;
539539 }
540540
541541 height = Math . max ( height , 16 ) + 3 ;
0 commit comments