Skip to content

Commit

Permalink
Remove stats from front page
Browse files Browse the repository at this point in the history
  • Loading branch information
tsherif committed Apr 2, 2019
1 parent 3e55f23 commit d72c110
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 49 deletions.
102 changes: 54 additions & 48 deletions website/src/components/example-runner.jsx
Expand Up @@ -37,7 +37,7 @@ const DEFAULT_ALT_TEXT = 'THIS EXAMPLE IS NOT SUPPORTED';

export default class ExampleRunner extends Component {
componentDidMount() {
const {example} = this.props;
const {example, noStats} = this.props;
const exampleApp = example.app;

// Ensure the example can find its images
Expand All @@ -49,51 +49,54 @@ export default class ExampleRunner extends Component {
exampleApp.start(this.props);

exampleApp.stats.reset();
const timeWidget = new StatsWidget(exampleApp.stats, {
container: this.refs.renderStats,
title: 'Render Time',
css: {
header: {
fontWeight: 'bold'

if (!noStats) {
const timeWidget = new StatsWidget(exampleApp.stats, {
container: this.refs.renderStats,
title: 'Render Time',
css: {
header: {
fontWeight: 'bold'
}
},
framesPerUpdate: 60,
formatters: {
'CPU Time': 'averageTime',
'GPU Time': 'averageTime',
'Frame Rate': 'fps'
},
resetOnUpdate: {
'CPU Time': true,
'GPU Time': true,
'Frame Rate': true
}
},
framesPerUpdate: 60,
formatters: {
'CPU Time': 'averageTime',
'GPU Time': 'averageTime',
'Frame Rate': 'fps'
},
resetOnUpdate: {
'CPU Time': true,
'GPU Time': true,
'Frame Rate': true
}
});

lumaStats.get('Memory Usage').reset();
const memWidget = new StatsWidget(lumaStats.get('Memory Usage'), {
container: this.refs.memStats,
css: {
header: {
fontWeight: 'bold'
});

lumaStats.get('Memory Usage').reset();
const memWidget = new StatsWidget(lumaStats.get('Memory Usage'), {
container: this.refs.memStats,
css: {
header: {
fontWeight: 'bold'
}
},
framesPerUpdate: 60,
formatters: {
'GPU Memory': 'memory',
'Buffer Memory': 'memory',
'Renderbuffer Memory': 'memory',
'Texture Memory': 'memory'
}
},
framesPerUpdate: 60,
formatters: {
'GPU Memory': 'memory',
'Buffer Memory': 'memory',
'Renderbuffer Memory': 'memory',
'Texture Memory': 'memory'
}
});

const updateStats = () => {
timeWidget.update();
memWidget.update();
this.animationFrame = window.requestAnimationFrame(updateStats);
};
});

const updateStats = () => {
timeWidget.update();
memWidget.update();
this.animationFrame = window.requestAnimationFrame(updateStats);
};

this.animationFrame = window.requestAnimationFrame(updateStats);
this.animationFrame = window.requestAnimationFrame(updateStats);
}
}

componentWillUnmount() {
Expand All @@ -106,7 +109,7 @@ export default class ExampleRunner extends Component {
}

render() {
const {example, width, height, name, noPanel, sourceLink} = this.props;
const {example, width, height, name, noPanel, noStats, sourceLink} = this.props;
const exampleApp = example.app;

const notSupported = example.isSupported && !example.isSupported();
Expand All @@ -125,10 +128,13 @@ export default class ExampleRunner extends Component {

return (
<div className="fg" style={{width, height, padding: 0, border: 0}}>
<div ref="stats" className="stats" style={STAT_STYLES}>
<div ref="renderStats" className="renderStats"/>
<div ref="memStats" className="memStats"/>
</div>
{
noStats ? null :
<div ref="stats" className="stats" style={STAT_STYLES}>
<div ref="renderStats" className="renderStats"/>
<div ref="memStats" className="memStats"/>
</div>
}
<canvas
id={this.props.canvas}
style={{width: '100%', height: '100%', padding: 0, border: 0}}
Expand Down
2 changes: 1 addition & 1 deletion website/src/components/hero.jsx
Expand Up @@ -34,7 +34,7 @@ export default class Hero extends Component {
return (
<section ref="banner" className="banner">
<div className="f hero">
<ExampleRunner example={HeroExample} sourceLink={HeroExample.path} noPanel />
<ExampleRunner example={HeroExample} sourceLink={HeroExample.path} noPanel noStats />
</div>
<div className="container" style={{background: 'transparent'}}>
<h1>luma.gl</h1>
Expand Down

0 comments on commit d72c110

Please sign in to comment.