Stackedit/lib/MathJax/jax/output/HTML-CSS/autoload/menclose.js

17 lines
8.0 KiB
JavaScript
Raw Normal View History

2013-05-12 00:48:25 +00:00
/*
* /MathJax/jax/output/HTML-CSS/autoload/menclose.js
*
2013-05-20 22:03:55 +00:00
* Copyright (c) 2009-2013 The MathJax Consortium
2013-05-12 00:48:25 +00:00
*
* Part of the MathJax library.
* See http://www.mathjax.org for details.
*
* Licensed under the Apache License, Version 2.0;
* you may not use this file except in compliance with the License.
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
2013-05-20 22:03:55 +00:00
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var d="2.2";var a=MathJax.ElementJax.mml,b=MathJax.OutputJax["HTML-CSS"];var c="http://www.w3.org/2000/svg";var f="urn:schemas-microsoft-com:vml";var e="mjxvml";a.menclose.Augment({toHTML:function(ab){var j=this.getValues("notation","thickness","padding","mathcolor","color");if(j.color&&!this.mathcolor){j.mathcolor=j.color}if(j.thickness==null){j.thickness=".075em"}if(j.padding==null){j.padding=".2em"}ab=this.HTMLcreateSpan(ab);var U=this.HTMLgetMu(ab),ae=this.HTMLgetScale();var V=b.length2em(j.padding,U,1/b.em)*ae;var M=b.length2em(j.thickness,U,1/b.em);var C=b.Em(M)+" solid";var v=b.createStack(ab);var s=b.createBox(v);this.HTMLmeasureChild(0,s);var J=s.bbox.h+V+M,O=s.bbox.d+V+M,k=s.bbox.w+2*(V+M);var N=b.createFrame(v,J+O,0,k,M,"none");N.id="MathJax-frame-"+this.spanID;b.addBox(v,N);v.insertBefore(N,s);var n=MathJax.Hub.SplitList(j.notation);var o=0,S=0,q=0,z=0,K=0,I=0;var Q,g;var G,ac,P;if(!j.mathcolor){j.mathcolor="black"}else{ab.style.color=j.mathcolor}for(var aa=0,Y=n.length;aa<Y;aa++){switch(n[aa]){case a.NOTATION.BOX:N.style.border=C;if(!b.msieBorderWidthBug){o=S=z=q=M}break;case a.NOTATION.ROUNDEDBOX:if(b.useVML){if(!g){g=this.HTMLvml(v,J,O,k,M,j.mathcolor)}P=Math.floor(1000*Math.min(k,J+O)-2*M);G=Math.floor(4000*(k-2*M)),ac=Math.floor(4000*(J+O-2*M));this.HTMLvmlElement(g,"shape",{style:{width:this.HTMLpx(k-2*M),height:this.HTMLpx(J+O-2*M),left:this.HTMLpx(M,0.5),top:this.HTMLpx(M,0.5)},path:"m "+P+",0 qx 0,"+P+" l 0,"+(ac-P)+" qy "+P+","+ac+" l "+(G-P)+","+ac+" qx "+G+","+(ac-P)+" l "+G+","+P+" qy "+(G-P)+",0 x e",coordsize:G+","+ac})}else{if(!Q){Q=this.HTMLsvg(v,J,O,k,M,j.mathcolor)}this.HTMLsvgElement(Q.firstChild,"rect",{x:1,y:1,width:this.HTMLpx(k-M)-1,height:this.HTMLpx(J+O-M)-1,rx:this.HTMLpx(Math.min(J+O,k)/4)})}break;case a.NOTATION.CIRCLE:if(b.useVML){if(!g){g=this.HTMLvml(v,J,O,k,M,j.mathcolor)}this.HTMLvmlElement(g,"oval",{style:{width:this.HTMLpx(k-2*M),height:this.HTMLpx(J+O-2*M),left:this.HTMLpx(M,0.5),top:this.HTMLpx(M,0.5)}})}else{if(!Q){Q=this.HTMLsvg(v,J,O,k,M,j.mathcolor)}this.HTMLsvgElement(Q.firstChild,"ellipse",{rx:this.HTMLpx(k/2-M),ry:this.HTMLpx((J+O)/2-M),cx:this.HTMLpx(k/2),cy:this.HTMLpx((J+O)/2)})}break;case a.NOTATION.LEFT:N.style.borderLeft=C;if(!b.msieBorderWidthBug){z=M}break;case a.NOTATION.ACTUARIAL:N.style.borderTop=C;if(!b.msieBorderWidthBug){o=M;N.bbox.w+=V-M}case a.NOTATION.RIGHT:N.style.borderRight=C;if(!b.msieBorderWidthBug){q=M}break;case a.NOTATION.VERTICALSTRIKE:var u=b.createRule(v,J+O-M/2,0,M);b.addBox(v,u);b.placeBox(u,V+M+s.bbox.w/2,-O,true);break;case a.NOTATION.TOP:N.style.borderTop=C;if(!b.msieBorderWidthBug){o=M}break;case a.NOTATION.BOTTOM:N.style.borderBottom=C;if(!b.msieBorderWidthBug){S=M}break;case a.NOTATION.HORIZONTALSTRIKE:var X=b.createRule(v,M,0,k-M/2);b.addBox(v,X);b.placeBox(X,0,(J+O)/2-O,true);break;case a.NOTATION.UPDIAGONALSTRIKE:if(b.useVML){if(!g){g=this.HTMLvml(v,J,O,k,M,j.mathcolor)}var F=this.HTMLvmlElement(g,"line",{from:"0,"+this.HTMLpx(J+O-M),to:this.HTMLpx(k)+",0"});if(this.arrow){this.HTMLvmlElement(F,"stroke",{endarrow:"classic"});F.to=this.HTMLpx(k)+","+this.HTMLpx(M)}}else{if(!Q){Q=this.HTMLsvg(v,J,O,k,M,j.mathcolor)}if(this.arrow){var Z=Math.sqrt(k*k+(J+O)*(J+O)),ad=1/Z*10*ae/b.em*M/0.075;G=k*ad;ac=(J+O)*ad;var E=k-M/2,A=M/2;if(A+ac-0.4*G<0){A=0.4*G-ac}this.HTMLsvgElement(Q.firstChild,"line",{x1:1,y1:this.HTMLpx(J+O-M),x2:this.HTMLpx(E-0.7*G),y2:this.HTMLpx(A+0.7*ac)});this.HTMLsvgElement(Q.firstChild,"polygon",{points:this.HTMLpx(E)+","+this.HTMLpx(A)+" "+this.HTMLpx(E-G-0.4*ac)+","+this.HTMLpx(A+ac-0.4*G)+" "+this.HTMLpx(E-0.7*G)+","+this.HTMLpx(A+0.7*ac)+" "+this.HTMLpx(E-G+0.4*ac)+","+this.HTMLpx(A+ac+0.4*G)+" "+this.HTMLpx(E)+","+this.HTMLpx(A),fill:j.mathcolor,stroke:"none"})}else{this.HTMLsvgElement(Q.firstChild,"line",{x1:1,y1:this.HTMLpx(J+O-M),x2:this.HTMLpx(k-M),y2:this.HTMLpx(M)})}}break;case a.NOTATION.DOWNDIAGONALSTRIKE:if(b.useVML){if(!g){g=this.HTMLvml(v,J,O,k,M,j.mathcolor)}this.HTMLvmlElement(g,"line",{from:"0,0",to:this.HTMLpx(k)+","+this.HTMLpx(
2013-05-12 00:48:25 +00:00