mirror of
https://gitlab.kit.edu/uskyk/typicalc.git
synced 2024-11-10 03:10:44 +00:00
Fix MathJax layout
This commit is contained in:
parent
10cd63abb4
commit
301069fe6c
@ -85,7 +85,31 @@ window.MathJax = {
|
||||
const OutputJax = startup.getOutputJax();
|
||||
const html = mathjax.document(root, {InputJax, OutputJax});
|
||||
html.render();
|
||||
window.svgPanZoomFun(root.querySelector("svg"));
|
||||
const svg = root.querySelector("svg");
|
||||
window.svgPanZoomFun(svg);
|
||||
var nodeIterator = svg.querySelectorAll("g[data-mml-node='mtr']");
|
||||
for (var a of nodeIterator) {
|
||||
var left = null;
|
||||
var i = 0;
|
||||
for (var node of a.childNodes) {
|
||||
if (i == 1 || i == 3) {
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
var bbox = node.getBBox();
|
||||
var mat = node.transform.baseVal[0];
|
||||
if (mat != undefined) {
|
||||
bbox.x += mat.matrix.e;
|
||||
}
|
||||
if (left == null) {
|
||||
left = bbox.x + bbox.width;
|
||||
} else {
|
||||
mat.matrix.e -= bbox.x - left;
|
||||
left = bbox.x + mat.matrix.e + bbox.width;
|
||||
}
|
||||
i += 1;
|
||||
}
|
||||
}
|
||||
if (callback != null) {
|
||||
callback(html);
|
||||
}
|
||||
@ -108,4 +132,4 @@ window.MathJax = {
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user