www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit c994ee999473b6049c627cdaffd27d708cdbbecf
parent 02066cb7cc452e2ece60c336c478802fa59da5c5
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Wed,  8 Apr 2015 10:48:40 -0400

Make zoom box handle overlaps properly, and position full-width tables better.

Diffstat:
Munpacked/jax/output/CommonHTML/autoload/mtable.js | 2+-
Munpacked/jax/output/CommonHTML/jax.js | 10+++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/unpacked/jax/output/CommonHTML/autoload/mtable.js b/unpacked/jax/output/CommonHTML/autoload/mtable.js @@ -450,7 +450,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () { }); box.appendChild(table); var labels = HTML.Element("mjx-stack"); table.style.display = "inline-table"; if (!table.style.width) table.style.width = "auto"; - labels.style.verticalAlign = table.style.verticalAlign = "top"; + labels.style.verticalAlign = "top"; node.style.verticalAlign = ""; if (shift) table.style[margin] = CHTML.Em(shift); // diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js @@ -574,9 +574,17 @@ var node = HTML.addElement(span,"mjx-chtml"); this.idPostfix = "-zoom"; jax.root.toCommonHTML(node); this.idPostfix = ""; // + // Adjust margins to prevent overlaps at the edges + // + var style = node.style, bbox = jax.root.CHTML; + if (bbox.t > bbox.h) style.marginTop = CHTML.Em(bbox.t-Math.max(bbox.h,CHTML.FONTDATA.lineH)); + if (bbox.b > bbox.d) style.marginBottom = CHTML.Em(bbox.b-Math.max(bbox.d,CHTML.FONTDATA.lineD)); + if (bbox.l < 0) style.paddingLeft = CHTML.Em(-bbox.l); + if (bbox.r > bbox.w) style.marginRight = CHTML.Em(bbox.r-bbox.w); + // // Get height and width of zoomed math and original math // - node.style.position = "absolute"; + style.position = "absolute"; var zW = node.offsetWidth, zH = node.offsetHeight, mH = math.firstChild.offsetHeight, mW = math.firstChild.offsetWidth; node.style.position = "";