From b84f7772f44b5779db4c90233854e92bbe3f673a Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Thu, 22 May 2014 18:04:59 -0400 Subject: [PATCH] Fix zoom box sizes for tagged equations in HTML-CSS and NativeMML output. Issue #824. --- unpacked/jax/output/HTML-CSS/jax.js | 7 +++++-- unpacked/jax/output/NativeMML/jax.js | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/unpacked/jax/output/HTML-CSS/jax.js b/unpacked/jax/output/HTML-CSS/jax.js index f1a61a225..7b0aafae4 100644 --- a/unpacked/jax/output/HTML-CSS/jax.js +++ b/unpacked/jax/output/HTML-CSS/jax.js @@ -777,7 +777,7 @@ this.idPostfix = "-zoom"; jax.root.toHTML(span,span); this.idPostfix = ""; this.zoomScale = 1; - var width = jax.root.HTMLspanElement().bbox.width; + var width = jax.root.HTMLspanElement().bbox.width, cwidth; if (width) { // Handle full-width displayed equations // FIXME: this is a hack for now @@ -785,7 +785,10 @@ var id = (jax.root.id||"MathJax-Span-"+jax.root.spanID)+"-zoom"; var child = document.getElementById(id).firstChild; while (child && child.style.width !== width) {child = child.nextSibling} - if (child) {child.style.width = "100%"} + if (child) { + var cwidth = child.offsetWidth; child.style.width = "100%"; + if (cwidth > Mw) {span.style.width = (cwidth+100)+"px"} + } } // // Get height and width of zoomed math and original math diff --git a/unpacked/jax/output/NativeMML/jax.js b/unpacked/jax/output/NativeMML/jax.js index 73342457a..5b4e046aa 100644 --- a/unpacked/jax/output/NativeMML/jax.js +++ b/unpacked/jax/output/NativeMML/jax.js @@ -432,6 +432,7 @@ Zoom: function (jax,span,math,Mw,Mh) { jax.root.toNativeMML(span); if (this.msieIE8HeightBug) {span.style.position = "absolute"} + if (nMML.widthBug) {span.style.width = span.parentNode.style.width = ""} var mW = math.offsetWidth || math.scrollWidth, mH = math.offsetHeight || math.scrollHeight; var zW = span.offsetWidth, zH = span.offsetHeight;