From 3828f5a4ff9dd616d9bbfa376a83f9cf94761557 Mon Sep 17 00:00:00 2001 From: "Mr.doob" Date: Sat, 6 Jun 2015 14:37:35 +0100 Subject: [PATCH] Updated stats.js --- examples/js/libs/stats.min.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/examples/js/libs/stats.min.js b/examples/js/libs/stats.min.js index 73744ef79b5660..85b86b4e93ea9f 100644 --- a/examples/js/libs/stats.min.js +++ b/examples/js/libs/stats.min.js @@ -1,6 +1,5 @@ // stats.js - http://github.com/mrdoob/stats.js -var Stats=function(){var l=Date.now(),m=l,g=0,n=Infinity,o=0,h=0,p=Infinity,q=0,r=0,s=0,f=document.createElement("div");f.id="stats";f.addEventListener("mousedown",function(b){b.preventDefault();t(++s%2)},!1);f.style.cssText="width:80px;opacity:0.9;cursor:pointer";var a=document.createElement("div");a.id="fps";a.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#002";f.appendChild(a);var i=document.createElement("div");i.id="fpsText";i.style.cssText="color:#0ff;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px"; -i.innerHTML="FPS";a.appendChild(i);var c=document.createElement("div");c.id="fpsGraph";c.style.cssText="position:relative;width:74px;height:30px;background-color:#0ff";for(a.appendChild(c);74>c.children.length;){var j=document.createElement("span");j.style.cssText="width:1px;height:30px;float:left;background-color:#113";c.appendChild(j)}var d=document.createElement("div");d.id="ms";d.style.cssText="padding:0 0 3px 3px;text-align:left;background-color:#020;display:none";f.appendChild(d);var k=document.createElement("div"); -k.id="msText";k.style.cssText="color:#0f0;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px";k.innerHTML="MS";d.appendChild(k);var e=document.createElement("div");e.id="msGraph";e.style.cssText="position:relative;width:74px;height:30px;background-color:#0f0";for(d.appendChild(e);74>e.children.length;)j=document.createElement("span"),j.style.cssText="width:1px;height:30px;float:left;background-color:#131",e.appendChild(j);var t=function(b){s=b;switch(s){case 0:a.style.display= -"block";d.style.display="none";break;case 1:a.style.display="none",d.style.display="block"}};return{REVISION:11,domElement:f,setMode:t,begin:function(){l=Date.now()},end:function(){var b=Date.now();g=b-l;n=Math.min(n,g);o=Math.max(o,g);k.textContent=g+" MS ("+n+"-"+o+")";var a=Math.min(30,30-30*(g/200));e.appendChild(e.firstChild).style.height=a+"px";r++;b>m+1E3&&(h=Math.round(1E3*r/(b-m)),p=Math.min(p,h),q=Math.max(q,h),i.textContent=h+" FPS ("+p+"-"+q+")",a=Math.min(30,30-30*(h/100)),c.appendChild(c.firstChild).style.height= -a+"px",m=b,r=0);return b},update:function(){l=this.end()}}}; +var Stats=function(){function a(b,a,c){b=document.createElement(b);b.id=a;b.style.cssText=c;return b}var m=performance&&performance.now?performance.now.bind(performance):Date.now,k=m(),n=k,c=0,p=Infinity,q=0,d=0,r=Infinity,t=0,u=0,v=0,l=a("div","stats","width:80px;opacity:0.9;cursor:pointer");l.addEventListener("mousedown",function(b){b.preventDefault();z(++v%2)},!1);var e=a("div","fps","padding:0 0 3px 3px;text-align:left;background:#002");l.appendChild(e);var w=a("div","fpsText","color:#0ff;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px"); +w.innerHTML="FPS";e.appendChild(w);var f=a("div","fpsGraph","position:relative;width:74px;height:30px;background:#0ff");for(e.appendChild(f);74>f.children.length;){var x=a("span","","width:1px;height:30px;float:left;background:#113");f.appendChild(x)}var g=a("div","ms","padding:0 0 3px 3px;text-align:left;background:#020;display:none");l.appendChild(g);var y=a("div","msText","color:#0f0;font-family:Helvetica,Arial,sans-serif;font-size:9px;font-weight:bold;line-height:15px");y.innerHTML="MS";g.appendChild(y); +var h=a("div","msGraph","position:relative;width:74px;height:30px;background:#0f0");for(g.appendChild(h);74>h.children.length;)x=a("span","","width:1px;height:30px;float:left;background:#131"),h.appendChild(x);var z=function(b){v=b;switch(v){case 0:e.style.display="block";g.style.display="none";break;case 1:e.style.display="none",g.style.display="block"}};return{REVISION:13,domElement:l,setMode:z,begin:function(){k=m()},end:function(){var b=m();c=b-k;p=Math.min(p,c);q=Math.max(q,c);y.textContent= +(c|0)+" MS ("+(p|0)+"-"+(q|0)+")";var a=Math.min(30,30-c/200*30);h.appendChild(h.firstChild).style.height=a+"px";u++;b>n+1E3&&(d=Math.round(1E3*u/(b-n)),r=Math.min(r,d),t=Math.max(t,d),w.textContent=d+" FPS ("+r+"-"+t+")",a=Math.min(30,30-d/100*30),f.appendChild(f.firstChild).style.height=a+"px",n=b,u=0);return b},update:function(){k=this.end()}}};"object"===typeof module&&(module.exports=Stats);