www

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

commit a9c66b5cee7d81fe2b0b68f70955ae1959515679
parent ea42f427f68c3b1cd5630ba8dc70e139a884cef4
Author: Davide P. Cervone <dpvc@union.edu>
Date:   Tue,  9 Sep 2014 19:22:02 -0400

Fix the alignment function so that it handles overlapping on the left and right better, and so we don't have to do it in the linebreaking directly.

Diffstat:
Munpacked/jax/output/SVG/autoload/multiline.js | 8+-------
Munpacked/jax/output/SVG/jax.js | 15++-------------
2 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/unpacked/jax/output/SVG/autoload/multiline.js b/unpacked/jax/output/SVG/autoload/multiline.js @@ -92,7 +92,6 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { if (isTop && parent.type !== "mtd") { if (SVG.linebreakWidth < SVG.BIGDIMEN) {svg.w = SVG.linebreakWidth} else {svg.w = SVG.cwidth} - svg.lw = svg.w; } var state = { @@ -212,10 +211,6 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { var align = this.SVGgetAlign(state,values), shift = this.SVGgetShift(state,values,align); // - // Add in space for the shift - // - line.x = shift; - // // Set the Y offset based on previous depth, leading, and current height // if (state.n > 0) { @@ -226,8 +221,7 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () { // // Place the new line // - svg.Align(line,align,0,state.Y); - svg.w = svg.lw; // in case a line extends past the right + svg.Align(line,align,0,state.Y,shift); // // Save the values needed for the future // diff --git a/unpacked/jax/output/SVG/jax.js b/unpacked/jax/output/SVG/jax.js @@ -889,20 +889,9 @@ this.childScale = svg.scale; this.childX = svg.x; this.childY = svg.y; this.n++; return svg; }, - Align: function (svg,align,dx,dy) { + Align: function (svg,align,dx,dy,shift) { 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); + var w = this.w; this.Add(svg,dx+(shift||0),dy); this.w = w; }, Clean: function () { if (this.h === -SVG.BIGDIMEN) {this.h = this.d = this.l = 0}