Make fractions with linebreaks center the elements based on the natural width (not 100%) in HTML-CSS and CHTML, just as in SVG. Resolves issue #1539.
This commit is contained in:
parent
7523687f4c
commit
68369285fd
|
@ -2413,6 +2413,7 @@
|
||||||
toCommonHTML: function (node) {
|
toCommonHTML: function (node) {
|
||||||
node = this.CHTMLdefaultNode(node,{
|
node = this.CHTMLdefaultNode(node,{
|
||||||
childNodes:["mjx-numerator","mjx-denominator"],
|
childNodes:["mjx-numerator","mjx-denominator"],
|
||||||
|
childOptions: {autowidth: true},
|
||||||
forceChild:true, noBBox:true, minChildren:2
|
forceChild:true, noBBox:true, minChildren:2
|
||||||
});
|
});
|
||||||
var values = this.getValues("linethickness","displaystyle",
|
var values = this.getValues("linethickness","displaystyle",
|
||||||
|
@ -2600,7 +2601,7 @@
|
||||||
/********************************************************/
|
/********************************************************/
|
||||||
|
|
||||||
MML.mrow.Augment({
|
MML.mrow.Augment({
|
||||||
toCommonHTML: function (node) {
|
toCommonHTML: function (node,options) {
|
||||||
node = this.CHTMLdefaultNode(node);
|
node = this.CHTMLdefaultNode(node);
|
||||||
var bbox = this.CHTML, H = bbox.h, D = bbox.d, hasNegative;
|
var bbox = this.CHTML, H = bbox.h, D = bbox.d, hasNegative;
|
||||||
for (var i = 0, m = this.data.length; i < m; i++) {
|
for (var i = 0, m = this.data.length; i < m; i++) {
|
||||||
|
@ -2609,6 +2610,7 @@
|
||||||
}
|
}
|
||||||
if (this.CHTMLlineBreaks()) {
|
if (this.CHTMLlineBreaks()) {
|
||||||
this.CHTMLmultiline(node);
|
this.CHTMLmultiline(node);
|
||||||
|
if (options.autowidth) node.style.width = "";
|
||||||
} else {
|
} else {
|
||||||
if (hasNegative && bbox.w) node.style.width = CHTML.Em(Math.max(0,bbox.w));
|
if (hasNegative && bbox.w) node.style.width = CHTML.Em(Math.max(0,bbox.w));
|
||||||
if (bbox.w < 0) node.style.marginRight = CHTML.Em(bbox.w);
|
if (bbox.w < 0) node.style.marginRight = CHTML.Em(bbox.w);
|
||||||
|
|
|
@ -1291,7 +1291,7 @@
|
||||||
if (bbox.tw) {BBOX.tw = bbox.tw}
|
if (bbox.tw) {BBOX.tw = bbox.tw}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
alignBox: function (span,align,y,dx) {
|
alignBox: function (span,align,y,dx,noskip) {
|
||||||
if (dx == null) {dx = 0}
|
if (dx == null) {dx = 0}
|
||||||
this.placeBox(span,dx,y); // set y position (and left aligned)
|
this.placeBox(span,dx,y); // set y position (and left aligned)
|
||||||
if (this.msiePlaceBoxBug) {
|
if (this.msiePlaceBoxBug) {
|
||||||
|
@ -1302,7 +1302,7 @@
|
||||||
while (node && node.nodeName !== "#text") {node = node.previousSibling}
|
while (node && node.nodeName !== "#text") {node = node.previousSibling}
|
||||||
if (node) {span.removeChild(node)}
|
if (node) {span.removeChild(node)}
|
||||||
}
|
}
|
||||||
var bbox = span.bbox; if (bbox.isMultiline) return;
|
var bbox = span.bbox; if (bbox.isMultiline && !noskip) return;
|
||||||
var isRelative = bbox.width != null && !bbox.isFixed;
|
var isRelative = bbox.width != null && !bbox.isFixed;
|
||||||
var r = 0, c = dx-bbox.w/2, l = "50%";
|
var r = 0, c = dx-bbox.w/2, l = "50%";
|
||||||
if (this.initialSkipBug) {r = bbox.w-bbox.rw-.1; c += bbox.lw}
|
if (this.initialSkipBug) {r = bbox.w-bbox.rw-.1; c += bbox.lw}
|
||||||
|
@ -2581,8 +2581,8 @@
|
||||||
HTMLCSS.createRule(rule,t,0,W+2*t);
|
HTMLCSS.createRule(rule,t,0,W+2*t);
|
||||||
HTMLCSS.placeBox(rule,0,a-t/2);
|
HTMLCSS.placeBox(rule,0,a-t/2);
|
||||||
}
|
}
|
||||||
HTMLCSS.alignBox(num,values.numalign,u);
|
HTMLCSS.alignBox(num,values.numalign,u,0,true);
|
||||||
HTMLCSS.alignBox(den,values.denomalign,-v);
|
HTMLCSS.alignBox(den,values.denomalign,-v,0,true);
|
||||||
}
|
}
|
||||||
this.HTMLhandleSpace(span);
|
this.HTMLhandleSpace(span);
|
||||||
this.HTMLhandleColor(span);
|
this.HTMLhandleColor(span);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user