@@ -415,6 +415,8 @@ function drawTexts(g, gd, maxLength) {
415
415
. call ( Drawing . font , fullLayout . legend . font )
416
416
. text ( isEditable ? ensureLength ( name , maxLength ) : name ) ;
417
417
418
+ svgTextUtils . positionText ( textEl , constants . textOffsetX , 0 ) ;
419
+
418
420
function textLayout ( s ) {
419
421
svgTextUtils . convertToTspans ( s , gd , function ( ) {
420
422
computeTextDimensions ( g , gd ) ;
@@ -520,7 +522,7 @@ function computeTextDimensions(g, gd) {
520
522
height = mathjaxBB . height ;
521
523
width = mathjaxBB . width ;
522
524
523
- Drawing . setTranslate ( mathjaxGroup , 40 , ( height / 4 ) ) ;
525
+ Drawing . setTranslate ( mathjaxGroup , 0 , ( height / 4 ) ) ;
524
526
}
525
527
else {
526
528
var text = g . select ( '.legendtext' ) ;
@@ -533,9 +535,7 @@ function computeTextDimensions(g, gd) {
533
535
// approximation to height offset to center the font
534
536
// to avoid getBoundingClientRect
535
537
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 ) ;
539
539
}
540
540
541
541
height = Math . max ( height , 16 ) + 3 ;
0 commit comments