Skip to content

Commit

Permalink
fix svgTextUtils for FF: use child element instead of SVG to getSize()
Browse files Browse the repository at this point in the history
  • Loading branch information
antoinerg committed Apr 17, 2019
1 parent 172c3e6 commit fe842c4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/lib/svg_text_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,11 @@ exports.convertToTspans = function(_context, gd, _callback) {
.style({overflow: 'visible', 'pointer-events': 'none'});

var fill = _context.node().style.fill || 'black';
newSvg.select('g').attr({fill: fill, stroke: fill});
var g = newSvg.select('g');
g.attr({fill: fill, stroke: fill});

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

0 comments on commit fe842c4

Please sign in to comment.