From e0a9ee0bc51bde94ad02e2219e74995a33c70303 Mon Sep 17 00:00:00 2001 From: Rohit Paul <113459757+RohitPaul12345@users.noreply.github.com> Date: Sun, 6 Aug 2023 00:04:40 +0530 Subject: [PATCH] Update stats.module.js --- build/stats.module.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/build/stats.module.js b/build/stats.module.js index 8a3edfd..2be8ef3 100644 --- a/build/stats.module.js +++ b/build/stats.module.js @@ -2,11 +2,11 @@ * @author mrdoob / http://mrdoob.com/ */ -var Stats = function () { +let Stats = function () { - var mode = 0; + let mode = 0; - var container = document.createElement( 'div' ); + let container = document.createElement( 'div' ); container.style.cssText = 'position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000'; container.addEventListener( 'click', function ( event ) { @@ -26,7 +26,7 @@ var Stats = function () { function showPanel( id ) { - for ( var i = 0; i < container.children.length; i ++ ) { + for ( let i = 0; i < container.children.length; i ++ ) { container.children[ i ].style.display = i === id ? 'block' : 'none'; @@ -38,14 +38,14 @@ var Stats = function () { // - var beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0; + let beginTime = ( performance || Date ).now(), prevTime = beginTime, frames = 0; - var fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) ); - var msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) ); + let fpsPanel = addPanel( new Stats.Panel( 'FPS', '#0ff', '#002' ) ); + let msPanel = addPanel( new Stats.Panel( 'MS', '#0f0', '#020' ) ); if ( self.performance && self.performance.memory ) { - var memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) ); + let memPanel = addPanel( new Stats.Panel( 'MB', '#f08', '#201' ) ); } @@ -70,7 +70,7 @@ var Stats = function () { frames ++; - var time = ( performance || Date ).now(); + let time = ( performance || Date ).now(); msPanel.update( time - beginTime, 200 ); @@ -83,7 +83,7 @@ var Stats = function () { if ( memPanel ) { - var memory = performance.memory; + let memory = performance.memory; memPanel.update( memory.usedJSHeapSize / 1048576, memory.jsHeapSizeLimit / 1048576 ); } @@ -111,20 +111,20 @@ var Stats = function () { Stats.Panel = function ( name, fg, bg ) { - var min = Infinity, max = 0, round = Math.round; - var PR = round( window.devicePixelRatio || 1 ); + let min = Infinity, max = 0, round = Math.round; + let PR = round( window.devicePixelRatio || 1 ); - var WIDTH = 80 * PR, HEIGHT = 48 * PR, + let WIDTH = 80 * PR, HEIGHT = 48 * PR, TEXT_X = 3 * PR, TEXT_Y = 2 * PR, GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR, GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR; - var canvas = document.createElement( 'canvas' ); + let canvas = document.createElement( 'canvas' ); canvas.width = WIDTH; canvas.height = HEIGHT; canvas.style.cssText = 'width:80px;height:48px'; - var context = canvas.getContext( '2d' ); + let context = canvas.getContext( '2d' ); context.font = 'bold ' + ( 9 * PR ) + 'px Helvetica,Arial,sans-serif'; context.textBaseline = 'top';