www

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

commit 3d68051118c4d0c5aaa76f797b27166527671da8
parent 4cf38304ac3ce1af0c53cde79bfeee1da8a77033
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Fri, 14 Feb 2014 10:02:06 -0500

Only set width to full for top-level math elements, and make svg.Align() handle expanding the box to accommodate larger lines.  Resolves issue #391.

Diffstat:
Munpacked/jax/output/SVG/autoload/multiline.js | 7+++++--
Munpacked/jax/output/SVG/jax.js | 11+++++++++++
2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/unpacked/jax/output/SVG/autoload/multiline.js b/unpacked/jax/output/SVG/autoload/multiline.js @@ -86,10 +86,13 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { // // Start with a fresh SVG element // and make it full width if we are breaking to a specific width + // in the top-level math element // svg = this.SVG(); - if (SVG.linebreakWidth < SVG.BIGDIMEN) {svg.w = SVG.linebreakWidth} - else {svg.w = SVG.cwidth/SVG.em * 1000} + if (isTop && parent.type !== "mtd") { + if (SVG.linebreakWidth < SVG.BIGDIMEN) {svg.w = SVG.linebreakWidth} + else {svg.w = SVG.cwidth/SVG.em * 1000} + } var state = { n: 0, Y: 0, diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js @@ -858,6 +858,17 @@ }, Align: function (svg,align,dx,dy) { dx = ({left: dx, center: (this.w - svg.w)/2, right: this.w - svg.w - dx})[align] || 0; + // + // If we extend to the left of the current contents, + // move the contents to the right and adjust the bounding box + // + if (dx < 0) { + if (this.element.childNodes.length) { + this.element.setAttribute("transform","translate("+Math.floor(-dx)+",0)"); + var g = SVG.Element("g"); g.appendChild(this.element); this.element = g; + } + this.l -= dx; this.w -= dx; this.r -= dx; dx = 0; + } this.Add(svg,dx,dy); }, Clean: function () {