Skip to content
Snippets Groups Projects
Commit 9f201904 authored by Ray Schamp's avatar Ray Schamp
Browse files

Lint

parent e71585a0
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ import Box from '../components/box/box.jsx'; ...@@ -10,7 +10,7 @@ import Box from '../components/box/box.jsx';
import GUI from '../containers/gui.jsx'; import GUI from '../containers/gui.jsx';
import ProjectLoaderHOC from '../lib/project-loader-hoc.jsx'; import ProjectLoaderHOC from '../lib/project-loader-hoc.jsx';
import styles from './player.css'; import './player.css';
const mapStateToProps = state => ({vm: state.vm}); const mapStateToProps = state => ({vm: state.vm});
...@@ -24,6 +24,12 @@ class Player extends React.Component { ...@@ -24,6 +24,12 @@ class Player extends React.Component {
this.handleResize = this.handleResize.bind(this); this.handleResize = this.handleResize.bind(this);
this.state = this.getWindowSize(); this.state = this.getWindowSize();
} }
componentDidMount () {
window.addEventListener('resize', this.handleResize);
}
componentWillUnmount () {
window.removeEventListener('resize', this.handleResize);
}
getWindowSize () { getWindowSize () {
return { return {
width: window.innerWidth, width: window.innerWidth,
...@@ -33,15 +39,9 @@ class Player extends React.Component { ...@@ -33,15 +39,9 @@ class Player extends React.Component {
handleResize () { handleResize () {
this.setState(this.getWindowSize()); this.setState(this.getWindowSize());
} }
componentDidMount () {
window.addEventListener('resize', this.handleResize);
}
componentWillUnmount () {
window.removeEventListener('resize', this.handleResize);
}
render () { render () {
let height = this.state.height - 40; let height = this.state.height - 40;
let width = height + height/3; let width = height + (height / 3);
if (width > this.state.width) { if (width > this.state.width) {
width = this.state.width; width = this.state.width;
height = width * .75; height = width * .75;
...@@ -49,10 +49,10 @@ class Player extends React.Component { ...@@ -49,10 +49,10 @@ class Player extends React.Component {
return ( return (
<GUI <GUI
{...this.props} {...this.props}
width={width}
style={{ style={{
margin: '0 auto' margin: '0 auto'
}} }}
width={width}
> >
<Box height={40}> <Box height={40}>
<VMGreenFlag <VMGreenFlag
...@@ -68,8 +68,8 @@ class Player extends React.Component { ...@@ -68,8 +68,8 @@ class Player extends React.Component {
/> />
</Box> </Box>
<VMStage <VMStage
width={width}
height={height} height={height}
width={width}
/> />
</GUI> </GUI>
); );
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment