diff --git a/html/can.js b/html/can.js index b56e4f6d..a6c43794 100644 --- a/html/can.js +++ b/html/can.js @@ -1,6 +1,6 @@ -function hasCan(){var c=document.getElementById('can');return !!(c.getContext&&c.getContext('2d'));} +function hasCan(){var c0=document.getElementById('can0');c=document.getElementById('can');return !!(c0&&c&&c.getContext&&c.getContext('2d'));} function sep(d){ans={};var ar=d.split("\t");var l=ar.length;for(var i=0;i(zm-1)){return(zm-1)}return z} +function gch(z,zm){if(z<0.5){return 0.5}if(z>(zm-0.5)){return(zm-0.5)}return z} function gchx(c,x){return gch(x*c['xm']+c['xo'],c['ctx'].canvas.width)} function gchy(c,y){return gch((1-y)*c['ym']+c['yo'],c['ctx'].canvas.height)} function gx0(c){return -c['xo']/c['xm']}; @@ -23,32 +23,34 @@ function gfi(c){gle(c);gst(c)} function gbd(c){gbe(c,0,0);gln(c,1,0);gln(c,1,1);gln(c,0,1);gle(c);gfl(c);gst(c)} function ggr(c,xs,ys,yt,xn,x0,x1,y0,y1,ar,nx,vx,vy,av){ gtso(c,xs,ys); -gss(c,'black');glw(c,0.25); +gss(c,'black');glw(c,0.2); gbe(c,0,1);gln(c,0,0);gln(c,1,0);gst(c); -glwr(c,0.1); +glw(c,0.01); var hi=c['ctx'].measureText('M').width; var wi=c['ctx'].measureText('1').width; for(var i=0;i<11;i++){var y=i/10.0;gbe(c,-0.01,y);gln(c,1,y);gst(c);var t=''+(((y1-y0)*i/10+y0).toFixed(2));gfz(c,0,y,-wi,0,t,'black','end')} gfz(c,gx0(c),0.55,wi,0,yt,'#0080ff','left'); var m=Math.round(0.5+xn/20.0); var f=1; -for(var i=0;ic['xm']){c['ym']=c['xm']}c['xo']=0.0;c['yo']=0.0;c['ctx'].canvas.width=c['xm'];c['ctx'].canvas.height=c['ym']} -function gdrw(d){var c={};gc(c); -gfs(c,'white');gss(c,'black');glw(c,1);gbd(c); +function gc(c,ok){var div=document.getElementById('can0');while(div.firstChild){div.removeChild(div.firstChild)}c['can']=document.createElement('canvas');c['wx']=window.innerWidth;c['wy']=window.innerHeight;c['xm']=Math.round(c['wx']*0.9+0.5);c['ym']=Math.round(c['wy']*0.8+0.5);if(c['ym']>c['xm']){c['ym']=c['xm']}c['xo']=0.0;c['yo']=0.0;c['ctx']=c['can'].getContext('2d');c['ctx'].canvas.width=c['xm']+1;c['ctx'].canvas.height=c['ym']+1;div.appendChild(c['can']);c['ok']=ok} +function gdrw(ok,d){var c={};gc(c,ok); +gfs(c,'white');gss(c,'#0000c0');glw(c,0.5);gbd(c); var rows=d['rows'];var ymin=-1;var ymax=0;var xmin=-1;var xmax=0; var tda=0; for(var i=0;iths){ymin=ths}if(ths>ymax)ymax=ths;d['nx:'+i]=sn(i,d['shift:'+i]);if(xmin==-1||xmin>s){xmin=s}if(xmax