Skip to content

Commit 4a9c865

Browse files
committed
Adjust code in mj postprocessing
1 parent 2e2d5dc commit 4a9c865

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

modules/base/ObjectPainter.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1044,9 +1044,9 @@ class ObjectPainter extends BasePainter {
10441044
}
10451045

10461046
all_args.forEach(arg => {
1047-
if (arg.mj_node && arg.applyAttributesToMathJax) {
1047+
if (arg.mj_node && arg.mj_func) {
10481048
const svg = arg.mj_node.select('svg'); // MathJax svg
1049-
arg.applyAttributesToMathJax(this, arg.mj_node, svg, arg, font_size, f);
1049+
arg.mj_func(this, arg.mj_node, svg, arg, font_size, f);
10501050
delete arg.mj_node; // remove reference
10511051
only_text = false;
10521052
} else if (arg.txt_g)

modules/base/latex.mjs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ function applyAttributesToMathJax(painter, mj_node, svg, arg, font_size, svg_fac
14401440

14411441
if (isNodeJs()) {
14421442
// workaround for NaN in viewBox produced by MathJax
1443-
let vb = svg.attr('viewBox');
1443+
const vb = svg.attr('viewBox');
14441444
if (isStr(vb) && vb.indexOf('NaN') > 0)
14451445
svg.attr('viewBox', vb.replaceAll('NaN', '600'));
14461446
// console.log('Problematic viewBox', vb, svg.select('text').node()?.innerHTML);
@@ -1490,8 +1490,6 @@ function applyAttributesToMathJax(painter, mj_node, svg, arg, font_size, svg_fac
14901490
if (arg.rotate)
14911491
trans += `${trans?' ':''}rotate(${arg.rotate})`;
14921492

1493-
1494-
14951493
mj_node.attr('transform', trans || null).attr('visibility', null);
14961494
}
14971495

@@ -1511,7 +1509,7 @@ async function produceMathjax(painter, mj_node, arg) {
15111509

15121510
repairMathJaxSvgSize(painter, mj_node, svg, arg);
15131511

1514-
arg.applyAttributesToMathJax = applyAttributesToMathJax;
1512+
arg.mj_func = applyAttributesToMathJax;
15151513
return true;
15161514
});
15171515
}

0 commit comments

Comments
 (0)