Skip to content

Commit fe842c4

Browse files
committed
fix svgTextUtils for FF: use child element instead of SVG to getSize()
1 parent 172c3e6 commit fe842c4

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/lib/svg_text_utils.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,11 @@ exports.convertToTspans = function(_context, gd, _callback) {
114114
.style({overflow: 'visible', 'pointer-events': 'none'});
115115

116116
var fill = _context.node().style.fill || 'black';
117-
newSvg.select('g').attr({fill: fill, stroke: fill});
117+
var g = newSvg.select('g');
118+
g.attr({fill: fill, stroke: fill});
118119

119-
var newSvgW = getSize(newSvg, 'width');
120-
var newSvgH = getSize(newSvg, 'height');
120+
var newSvgW = getSize(g, 'width');
121+
var newSvgH = getSize(g, 'height');
121122
var newX = +_context.attr('x') - newSvgW *
122123
{start: 0, middle: 0.5, end: 1}[_context.attr('text-anchor') || 'start'];
123124
// font baseline is about 1/4 fontSize below centerline

0 commit comments

Comments
 (0)