Better construct empty frames when maction@selection is invalid

This commit is contained in:
Frédéric Wang 2013-02-11 14:29:09 +01:00
parent 4fefa49080
commit d0b024243b
2 changed files with 14 additions and 11 deletions

View File

@ -43,15 +43,19 @@ MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function () {
HTMLtooltip: HTMLCSS.addElement(document.body,"div",{id:"MathJax_Tooltip"}),
toHTML: function (span,HW,D) {
span = this.HTMLhandleSize(this.HTMLcreateSpan(span)); span.bbox = null;
var selected = this.selected();
if (selected.type !== "null") {
var box = selected.toHTML(span);
if (D != null) {HTMLCSS.Remeasured(selected.HTMLstretchV(span,HW,D),span)}
else if (HW != null) {HTMLCSS.Remeasured(selected.HTMLstretchH(span,HW),span)}
else {HTMLCSS.Measured(box,span)}
this.HTMLhandleHitBox(span);
if (selected.type == "null") {
span = this.HTMLcreateSpan(span);
span.bbox = {h:0, d:0, w:0, lw:0, rw:0};
return span;
}
span = this.HTMLhandleSize(this.HTMLcreateSpan(span)); span.bbox = null;
var box = selected.toHTML(span);
if (D != null) {HTMLCSS.Remeasured(selected.HTMLstretchV(span,HW,D),span)}
else if (HW != null) {
HTMLCSS.Remeasured(selected.HTMLstretchH(span,HW),span)
} else {HTMLCSS.Measured(box,span)}
this.HTMLhandleHitBox(span);
this.HTMLhandleSpace(span);
this.HTMLhandleColor(span);
return span;

View File

@ -46,10 +46,9 @@ MathJax.Hub.Register.StartupHook("SVG Jax Ready",function () {
this.SVGgetStyles();
var svg = this.SVG();
var selected = this.selected();
if (selected.type !== "null") {
svg.Add(this.SVGdataStretched(this.Get("selection")-1,HW,D));
this.SVGhandleHitBox(svg);
}
if (selected.type == "null") {this.SVGsaveData(svg);return svg;}
svg.Add(this.SVGdataStretched(this.Get("selection")-1,HW,D));
this.SVGhandleHitBox(svg);
this.SVGhandleSpace(svg);
this.SVGhandleColor(svg);
this.SVGsaveData(svg);