Skip to content

Commit 424c686

Browse files
authored
Merge pull request #3783 from plotly/fix-2616
fix svgTextUtils for FF: use child element instead of SVG to getSize()
2 parents fe0bd1e + b1177a6 commit 424c686

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

Diff for: 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

Diff for: tasks/test_bundle.js

+17
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ glob(pathToJasmineBundleTests + '/*.js', function(err, files) {
3131
};
3232
});
3333

34+
var mathjaxTestFirefox = function(cb) {
35+
var cmd = [
36+
'karma', 'start',
37+
path.join(constants.pathToRoot, 'test', 'jasmine', 'karma.conf.js'),
38+
'--FF',
39+
'--bundleTest=mathjax',
40+
'--nowatch'
41+
].join(' ');
42+
43+
console.log('Running: ' + cmd);
44+
45+
exec(cmd, function(err) {
46+
cb(null, err);
47+
}).stdout.pipe(process.stdout);
48+
};
49+
tasks.push(mathjaxTestFirefox);
50+
3451
runSeries(tasks, function(err, results) {
3552
if(err) throw err;
3653

0 commit comments

Comments
 (0)