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

20 lines
8.6 KiB
JavaScript
Raw Normal View History

2013-10-09 01:15:00 +00:00
/*
* /MathJax/jax/output/HTML-CSS/autoload/menclose.js
2013-11-19 22:02:44 +00:00
*
2013-10-09 01:15:00 +00:00
* Copyright (c) 2009-2013 The MathJax Consortium
*
2013-11-19 22:02:44 +00:00
* Licensed under the Apache License, Version 2.0 (the "License");
2013-10-09 01:15:00 +00:00
* you may not use this file except in compliance with the License.
2013-11-19 22:02:44 +00:00
* You may obtain a copy of the License at
2013-10-09 01:15:00 +00:00
*
* http://www.apache.org/licenses/LICENSE-2.0
2013-11-19 22:02:44 +00:00
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
2013-10-09 01:15:00 +00:00
*/
2013-11-19 22:02:44 +00:00
MathJax.Hub.Register.StartupHook("HTML-CSS Jax Ready",function(){var d="2.3";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(ac){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"}ac=this.HTMLcreateSpan(ac);var V=this.HTMLgetMu(ac),af=this.HTMLgetScale();var X=b.length2em(j.padding,V,1/b.em)*af;var N=b.length2em(j.thickness,V,1/b.em);var E=b.Em(N)+" solid";var z=b.createStack(ac);var v=b.createBox(z);this.HTMLmeasureChild(0,v);var K=v.bbox.h+X+N,P=v.bbox.d+X+N,o=v.bbox.w+2*(X+N);var O=b.createFrame(z,K+P,0,o,N,"none");O.id="MathJax-frame-"+this.spanID;b.addBox(z,O);z.insertBefore(O,v);var s=0,U=0,u=0,A=0,M=0,J=0;var S,g;var I,ad,Q;if(!j.mathcolor){j.mathcolor="black"}else{ac.style.color=j.mathcolor}var k=MathJax.Hub.SplitList(j.notation),q={};for(var ab=0,Z=k.length;ab<Z;ab++){q[k[ab]]=true}if(q[a.NOTATION.UPDIAGONALARROW]){q[a.NOTATION.UPDIAGONALSTRIKE]=false}var G;for(var Y in q){if(!q.hasOwnProperty(Y)||!q[Y]){continue}switch(Y){case a.NOTATION.BOX:O.style.border=E;if(!b.msieBorderWidthBug){s=U=A=u=N}break;case a.NOTATION.ROUNDEDBOX:if(b.useVML){if(!g){g=this.HTMLvml(z,K,P,o,N,j.mathcolor)}Q=Math.floor(1000*Math.min(o,K+P)-2*N);I=Math.floor(4000*(o-2*N)),ad=Math.floor(4000*(K+P-2*N));this.HTMLvmlElement(g,"shape",{style:{width:this.HTMLpx(o-2*N),height:this.HTMLpx(K+P-2*N),left:this.HTMLpx(N,0.5),top:this.HTMLpx(N,0.5)},path:"m "+Q+",0 qx 0,"+Q+" l 0,"+(ad-Q)+" qy "+Q+","+ad+" l "+(I-Q)+","+ad+" qx "+I+","+(ad-Q)+" l "+I+","+Q+" qy "+(I-Q)+",0 x e",coordsize:I+","+ad})}else{if(!S){S=this.HTMLsvg(z,K,P,o,N,j.mathcolor)}this.HTMLsvgElement(S.firstChild,"rect",{x:1,y:1,width:this.HTMLpx(o-N)-1,height:this.HTMLpx(K+P-N)-1,rx:this.HTMLpx(Math.min(K+P,o)/4)})}break;case a.NOTATION.CIRCLE:if(b.useVML){if(!g){g=this.HTMLvml(z,K,P,o,N,j.mathcolor)}this.HTMLvmlElement(g,"oval",{style:{width:this.HTMLpx(o-2*N),height:this.HTMLpx(K+P-2*N),left:this.HTMLpx(N,0.5),top:this.HTMLpx(N,0.5)}})}else{if(!S){S=this.HTMLsvg(z,K,P,o,N,j.mathcolor)}this.HTMLsvgElement(S.firstChild,"ellipse",{rx:this.HTMLpx(o/2-N),ry:this.HTMLpx((K+P)/2-N),cx:this.HTMLpx(o/2),cy:this.HTMLpx((K+P)/2)})}break;case a.NOTATION.LEFT:O.style.borderLeft=E;if(!b.msieBorderWidthBug){A=N}break;case a.NOTATION.ACTUARIAL:O.style.borderTop=E;if(!b.msieBorderWidthBug){s=N;O.bbox.w+=X-N}case a.NOTATION.RIGHT:O.style.borderRight=E;if(!b.msieBorderWidthBug){u=N}break;case a.NOTATION.VERTICALSTRIKE:G=b.createRule(z,K+P-N/2,0,N);b.addBox(z,G);b.placeBox(G,X+N+v.bbox.w/2,-P,true);break;case a.NOTATION.TOP:O.style.borderTop=E;if(!b.msieBorderWidthBug){s=N}break;case a.NOTATION.BOTTOM:O.style.borderBottom=E;if(!b.msieBorderWidthBug){U=N}break;case a.NOTATION.HORIZONTALSTRIKE:G=b.createRule(z,N,0,o-N/2);b.addBox(z,G);b.placeBox(G,0,(K+P)/2-P,true);break;case a.NOTATION.UPDIAGONALSTRIKE:if(b.useVML){if(!g){g=this.HTMLvml(z,K,P,o,N,j.mathcolor)}G=this.HTMLvmlElement(g,"line",{from:"0,"+this.HTMLpx(K+P-N),to:this.HTMLpx(o)+",0"})}else{if(!S){S=this.HTMLsvg(z,K,P,o,N,j.mathcolor)}this.HTMLsvgElement(S.firstChild,"line",{x1:1,y1:this.HTMLpx(K+P-N),x2:this.HTMLpx(o-N),y2:this.HTMLpx(N)})}break;case a.NOTATION.UPDIAGONALARROW:if(b.useVML){if(!g){g=this.HTMLvml(z,K,P,o,N,j.mathcolor)}G=this.HTMLvmlElement(g,"line",{from:"0,"+this.HTMLpx(K+P-N),to:this.HTMLpx(o)+","+this.HTMLpx(N)});this.HTMLvmlElement(G,"stroke",{endarrow:"classic"})}else{if(!S){S=this.HTMLsvg(z,K,P,o,N,j.mathcolor)}var aa=Math.sqrt(o*o+(K+P)*(K+P)),ae=1/aa*10*af/b.em*N/0.075;I=o*ae;ad=(K+P)*ae;var F=o-N/2,C=N/2;if(C+ad-0.4*I<0){C=0.4*I-ad}this.HTMLsvgElement(S.firstChild,"line",{x1:1,y1:this.HTMLpx(K+P-N),x2:this.HTMLpx(F-0.7*I),y2:this.HTMLpx(C+0.7*ad)});this.HTMLsvgElement(S.firstChild,"polygon",{points:this.HTMLpx(F)+","+this.HTMLpx(C)+" "+this.HTMLpx(F-I-0.4*ad)+","+this.HTMLpx(C+ad-0.4*I)+" "+this.HTMLpx(F-0.7*I)+","+this.HTMLpx(C+