Skip to content

Commit

Permalink
More fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Apr 10, 2016
1 parent 10a0916 commit ed580ea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ var Stats = function () {

}

mode = id;

}

//
Expand Down Expand Up @@ -125,7 +127,7 @@ Stats.Panel = function ( name, fg, bg ) {
context.globalAlpha = 0.9;
context.fillRect( 3, 15, 74, 30 );

var min = Infinity, max = 0;
var min = Infinity, max = 0, round = Math.round;

return {

Expand All @@ -140,15 +142,15 @@ Stats.Panel = function ( name, fg, bg ) {
context.fillStyle = bg;
context.fillRect( 0, 0, 80, 15 );
context.fillStyle = fg;
context.fillText( ( value | 0 ) + ' ' + name + ' (' + ( min | 0 ) + '-' + ( max | 0 ) + ')', 3, 10 );
context.fillText( round( value ) + ' ' + name + ' (' + round( min ) + '-' + round( max ) + ')', 3, 10 );

context.drawImage( canvas, 4, 15, 74, 30, 3, 15, 74, 30 );

context.fillRect( 76, 15, 1, 30 );

context.fillStyle = bg;
context.globalAlpha = 0.9;
context.fillRect( 76, 15, 1, 30 - ( ( value / maxValue ) * 30 ) | 0 );
context.fillRect( 76, 15, 1, 30 - round( ( value / maxValue ) * 30 ) );

}

Expand Down

0 comments on commit ed580ea

Please sign in to comment.