1
0
mirror of https://github.com/kalmarek/SmallHyperbolic synced 2024-11-12 12:50:29 +01:00

fix: make math foreignObject larger

Chrome returns different height of BoundingRect than Firefox
This commit is contained in:
Marek Kaluba 2022-02-24 02:36:49 +01:00
parent c42a98459a
commit e2278a2961
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -48,11 +48,11 @@ async function add_search() {
async function switch_katex(toggle=true) {
let math_objects = document.getElementsByClassName("math");
for (let elt of math_objects) {
toggleKaTeX(elt, toggle);
await toggleKaTeX(elt, toggle);
let fObj = elt.parentElement;
let rect = elt.getElementsByClassName("math-tex")[0].getBoundingClientRect();
fObj.setAttribute("width", rect.width+4);
fObj.setAttribute("height", rect.height+4);
fObj.setAttribute("width", rect.width+8);
fObj.setAttribute("height", rect.height+8);
}
};