Fix up some CSS, and some other minor details.

This commit is contained in:
Davide P. Cervone 2015-03-01 10:39:13 -05:00
parent 6399338521
commit 7b723003bf

View File

@ -37,7 +37,7 @@
HFUZZ = .05, DFUZZ = 0; // adjustments to bounding box of character boxes HFUZZ = .05, DFUZZ = 0; // adjustments to bounding box of character boxes
var STYLES = { var STYLES = {
".MJXc-display": { ".MathJax_CHTML_Display": {
"display": "block", "display": "block",
"text-align": "center", "text-align": "center",
"margin": "1em 0" "margin": "1em 0"
@ -54,6 +54,7 @@
"mjx-mfrac": {"vertical-align":".25em"}, "mjx-mfrac": {"vertical-align":".25em"},
"mjx-fbox": {width:"100%"}, "mjx-fbox": {width:"100%"},
"mjx-ftable": {display:"table", width:"100%"},
"mjx-mphantom": {"visibility":"hidden"}, "mjx-mphantom": {"visibility":"hidden"},
@ -68,7 +69,7 @@
"mjx-box": {display:"inline-block"}, "mjx-box": {display:"inline-block"},
"mjx-block": {display:"block"}, "mjx-block": {display:"block"},
"mjx-char": {display:"block", "xline-height":"normal"}, "mjx-char": {display:"block"},
"mjx-itable": {display:"inline-table"}, "mjx-itable": {display:"inline-table"},
"mjx-row": {display:"table-row"}, "mjx-row": {display:"table-row"},
"mjx-cell": {display:"table-cell", "text-align":"center"}, "mjx-cell": {display:"table-cell", "text-align":"center"},
@ -237,7 +238,7 @@
this.initCHTML(math,span); this.initCHTML(math,span);
math.setTeXclass(); math.setTeXclass();
try {math.toCommonHTML(span)} catch (err) { try {math.toCommonHTML(span)} catch (err) {
if (err.restart) {while (span.firstChild) {span.removeChild(span.firstChild)}} while (span.firstChild) span.removeChild(span.firstChild);
throw err; throw err;
} }
// //
@ -568,6 +569,9 @@
if (Math.abs(m) < .001) return "0em"; if (Math.abs(m) < .001) return "0em";
return (m.toFixed(3).replace(/\.?0+$/,""))+"em"; return (m.toFixed(3).replace(/\.?0+$/,""))+"em";
}, },
unEm: function (m) {
return parseFloat(m);
},
scaleBBox: function (bbox,level,dlevel) { scaleBBox: function (bbox,level,dlevel) {
var scale = Math.pow(SCRIPTFACTOR,Math.min(2,level)-(dlevel||0)); var scale = Math.pow(SCRIPTFACTOR,Math.min(2,level)-(dlevel||0));
@ -628,7 +632,7 @@
CHTMLcreateNode: function (node) { CHTMLcreateNode: function (node) {
if (!this.CHTML) this.CHTML = {}; if (!this.CHTML) this.CHTML = {};
this.CHTML = {w:0, h:0, d:0, l:0, r:0, t:0, b:0}; this.CHTML = {w:0, h:0, d:0, l:0, r:0};
if (this.inferred) return node; if (this.inferred) return node;
if (!this.CHTMLnodeID) {this.CHTMLnodeID = CHTML.GetID()}; if (!this.CHTMLnodeID) {this.CHTMLnodeID = CHTML.GetID()};
var id = (this.id || "MJXc-Node-"+this.CHTMLnodeID); var id = (this.id || "MJXc-Node-"+this.CHTMLnodeID);
@ -707,9 +711,16 @@
// //
CHTMLdrawBBox: function (node) { CHTMLdrawBBox: function (node) {
var bbox = this.CHTML; var bbox = this.CHTML;
HTML.addElement(node.parentNode,"mjx-box",{style:{opacity:.5,"margin-left":CHTML.Em(-bbox.w)}},[ HTML.addElement(node.parentNode,"mjx-box",
["mjx-box",{style:{height:CHTML.Em(bbox.h),width:CHTML.Em(bbox.w),"background-color":"red"}}], {style:{opacity:.5,"margin-left":CHTML.Em(-bbox.w-(bbox.R||0))}},[
["mjx-box",{style:{height:CHTML.Em(bbox.d),width:CHTML.Em(bbox.w),"margin-left":CHTML.Em(-bbox.w),"vertical-align":CHTML.Em(-bbox.d),"background-color":"green"}}] ["mjx-box",{style:{
height:CHTML.Em(bbox.h),width:CHTML.Em(bbox.w),"background-color":"red"}
}],
["mjx-box",{style:{
height:CHTML.Em(bbox.d),width:CHTML.Em(bbox.w),
"margin-left":CHTML.Em(-bbox.w),"vertical-align":CHTML.Em(-bbox.d),
"background-color":"green"}
}]
]); ]);
}, },