From 18e5a0ef6df4e43bec9fd8f54c012a25c8d2b4f7 Mon Sep 17 00:00:00 2001 From: "Davide P. Cervone" Date: Wed, 4 Mar 2015 12:54:46 -0500 Subject: [PATCH] Rename CHTMLstretchChild to CHTMLstretchChildV, and add CHTMLstretchChildH (still to be implemented in mo). --- unpacked/jax/output/CommonHTML/jax.js | 35 ++++++++++++++++++--------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/unpacked/jax/output/CommonHTML/jax.js b/unpacked/jax/output/CommonHTML/jax.js index 8d73774b2..8e6048250 100644 --- a/unpacked/jax/output/CommonHTML/jax.js +++ b/unpacked/jax/output/CommonHTML/jax.js @@ -662,14 +662,27 @@ } } else if (options.forceChild) {HTML.addElement(node,"span")} }, - CHTMLstretchChild: function (i,H,D) { + CHTMLstretchChildV: function (i,H,D) { var data = this.data[i]; if (data && data.CHTMLcanStretch("Vertical",H,D)) { var bbox = this.CHTML, dbox = data.CHTML, w = dbox.w; - data.CHTMLstretchV(H,D); - bbox.w += dbox.w - w; - if (dbox.h > bbox.h) bbox.h = dbox.h; - if (dbox.d > bbox.d) bbox.d = dbox.d; + if (dbox.h !== H || dbox.d !== D) { + data.CHTMLstretchV(H,D); + bbox.w += dbox.w - w; + if (dbox.h > bbox.h) bbox.h = dbox.h; + if (dbox.d > bbox.d) bbox.d = dbox.d; + } + } + }, + CHTMLstretchChildH: function (i,W) { + var data = this.data[i]; + if (data) { + var bbox = this.CHTML, dbox = data.CHTML; + if (dbox.w !== W) { + data.CHTMLstretchH(W); + if (dbox.h > bbox.h) bbox.h = dbox.h; + if (dbox.d > bbox.d) bbox.d = dbox.d; + } } }, @@ -1246,15 +1259,15 @@ } this.CHTMLaddChild(node,"close",{}); // - // Check for streching the elements + // Check for stretching the elements // var H = this.CHTML.h, D = this.CHTML.d; - this.CHTMLstretchChild("open",H,D); + this.CHTMLstretchChildV("open",H,D); for (i = 0, m = this.data.length; i < m; i++) { - this.CHTMLstretchChild("sep"+i,H,D); - this.CHTMLstretchChild(i,H,D); + this.CHTMLstretchChildV("sep"+i,H,D); + this.CHTMLstretchChildV(i,H,D); } - this.CHTMLstretchChild("close",H,D); + this.CHTMLstretchChildV("close",H,D); return node; } }); @@ -1263,7 +1276,7 @@ toCommonHTML: function (node) { node = this.CHTMLdefaultNode(node); var H = this.CHTML.h, D = this.CHTML.d; - for (var i = 0, m = this.data.length; i < m; i++) this.CHTMLstretchChild(i,H,D); + for (var i = 0, m = this.data.length; i < m; i++) this.CHTMLstretchChildV(i,H,D); return node; } });