Fix zoom box sizes for tagged equations in HTML-CSS and NativeMML output. Issue #824.

This commit is contained in:
Davide P. Cervone 2014-05-22 18:04:59 -04:00
parent ae3197913b
commit b84f7772f4
2 changed files with 6 additions and 2 deletions

View File

@ -777,7 +777,7 @@
this.idPostfix = "-zoom"; jax.root.toHTML(span,span); this.idPostfix = ""; this.idPostfix = "-zoom"; jax.root.toHTML(span,span); this.idPostfix = "";
this.zoomScale = 1; this.zoomScale = 1;
var width = jax.root.HTMLspanElement().bbox.width; var width = jax.root.HTMLspanElement().bbox.width, cwidth;
if (width) { if (width) {
// Handle full-width displayed equations // Handle full-width displayed equations
// FIXME: this is a hack for now // FIXME: this is a hack for now
@ -785,7 +785,10 @@
var id = (jax.root.id||"MathJax-Span-"+jax.root.spanID)+"-zoom"; var id = (jax.root.id||"MathJax-Span-"+jax.root.spanID)+"-zoom";
var child = document.getElementById(id).firstChild; var child = document.getElementById(id).firstChild;
while (child && child.style.width !== width) {child = child.nextSibling} 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 // Get height and width of zoomed math and original math

View File

@ -432,6 +432,7 @@
Zoom: function (jax,span,math,Mw,Mh) { Zoom: function (jax,span,math,Mw,Mh) {
jax.root.toNativeMML(span); jax.root.toNativeMML(span);
if (this.msieIE8HeightBug) {span.style.position = "absolute"} if (this.msieIE8HeightBug) {span.style.position = "absolute"}
if (nMML.widthBug) {span.style.width = span.parentNode.style.width = ""}
var mW = math.offsetWidth || math.scrollWidth, var mW = math.offsetWidth || math.scrollWidth,
mH = math.offsetHeight || math.scrollHeight; mH = math.offsetHeight || math.scrollHeight;
var zW = span.offsetWidth, zH = span.offsetHeight; var zW = span.offsetWidth, zH = span.offsetHeight;