hide buttons bar when sliced

This commit is contained in:
casperlamboo 2017-11-12 00:47:06 +01:00
parent 624a178bb2
commit 4654858c3e

View File

@ -49,6 +49,7 @@ class Interface extends React.Component {
}; };
state = { state = {
controlMode: 'translate', controlMode: 'translate',
sliced: false
}; };
componentDidMount() { componentDidMount() {
@ -113,18 +114,19 @@ class Interface extends React.Component {
render() { render() {
const { width, height, classes } = this.props; const { width, height, classes } = this.props;
const { sliced } = this.state;
return ( return (
<div style={{ width, height }} className={classes.container}> <div style={{ width, height }} className={classes.container}>
<canvas className={classes.canvas} ref="canvas" width={width} height={height} /> <canvas className={classes.canvas} ref="canvas" width={width} height={height} />
<div className={classes.controlBar}> {!sliced && <div className={classes.controlBar}>
<button onClick={this.resetMesh}>Reset</button> <button onClick={this.resetMesh}>Reset</button>
<button onClick={() => this.setState({ controlMode: 'translate' })}>Translate</button> <button onClick={() => this.setState({ controlMode: 'translate' })}>Translate</button>
<button onClick={() => this.setState({ controlMode: 'rotate' })}>Rotate</button> <button onClick={() => this.setState({ controlMode: 'rotate' })}>Rotate</button>
<button onClick={() => this.setState({ controlMode: 'scale' })}>Scale</button> <button onClick={() => this.setState({ controlMode: 'scale' })}>Scale</button>
</div> </div>}
<div className={classes.sliceBar}> {!sliced && <div className={classes.sliceBar}>
<button onClick={this.slice}>Slice</button> <button onClick={this.slice}>Slice</button>
</div> </div>}
</div> </div>
); );
} }