2017-07-27 16:41:41 -04:00
|
|
|
import bindAll from 'lodash.bindall';
|
2017-07-13 14:03:48 -04:00
|
|
|
import React from 'react';
|
2017-07-17 18:39:50 -04:00
|
|
|
import PaperCanvas from '../containers/paper-canvas.jsx';
|
2017-08-15 18:11:02 -04:00
|
|
|
import BrushMode from '../containers/brush-mode.jsx';
|
|
|
|
import EraserMode from '../containers/eraser-mode.jsx';
|
2017-07-13 14:03:48 -04:00
|
|
|
|
2017-08-29 17:20:08 -04:00
|
|
|
import styles from './paint-editor.css';
|
|
|
|
|
2017-07-27 11:45:41 -04:00
|
|
|
class PaintEditorComponent extends React.Component {
|
2017-07-27 16:41:41 -04:00
|
|
|
constructor (props) {
|
|
|
|
super(props);
|
|
|
|
bindAll(this, [
|
|
|
|
'setCanvas'
|
|
|
|
]);
|
|
|
|
this.state = {};
|
|
|
|
}
|
|
|
|
setCanvas (canvas) {
|
|
|
|
this.setState({canvas: canvas});
|
|
|
|
}
|
2017-07-27 11:45:41 -04:00
|
|
|
render () {
|
|
|
|
return (
|
2017-08-29 17:20:08 -04:00
|
|
|
<div className={styles.editorContainer}>
|
|
|
|
{/* First row */}
|
|
|
|
<div className={styles.row}>
|
|
|
|
{/* Name field */}
|
|
|
|
<div className={styles.inputGroup}>
|
|
|
|
{/* Todo use Label and BufferedInput from Gui */}
|
|
|
|
<label>Costume
|
|
|
|
<input value="meow"/>
|
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* Undo/Redo */}
|
|
|
|
<div className={styles.inputGroup}>
|
|
|
|
<div className={styles.buttonGroup}>
|
|
|
|
<button
|
|
|
|
className={styles.button}
|
|
|
|
>
|
|
|
|
Undo
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
className={styles.button}
|
|
|
|
>
|
|
|
|
Redo
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* To be Front/back */}
|
|
|
|
<div className={styles.inputGroup}>
|
|
|
|
<button
|
|
|
|
className={styles.button}
|
|
|
|
>
|
|
|
|
Front
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
className={styles.button}
|
|
|
|
>
|
|
|
|
Back
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* To be Group/Ungroup */}
|
|
|
|
<div className={styles.inputGroup}>
|
|
|
|
<button
|
|
|
|
className={styles.button}
|
|
|
|
>
|
|
|
|
Group
|
|
|
|
</button>
|
|
|
|
<button
|
|
|
|
className={styles.button}
|
|
|
|
>
|
|
|
|
Ungroup
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
{/* Second Row */}
|
|
|
|
<div className={styles.row}>
|
|
|
|
{/* To be fill */}
|
|
|
|
<div className={styles.inputGroup}>
|
|
|
|
<button
|
|
|
|
className={styles.button}
|
|
|
|
>
|
|
|
|
Fill
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
{/* To be stroke */}
|
|
|
|
<div className={styles.inputGroup}>
|
|
|
|
<button
|
|
|
|
className={styles.button}
|
|
|
|
>
|
|
|
|
Stroke
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles.inputGroup}>
|
|
|
|
Mode tools
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div className={styles.row}>
|
|
|
|
{/* Modes */}
|
|
|
|
{this.state.canvas ? (
|
|
|
|
<div className={styles.modeSelector}>
|
|
|
|
<BrushMode canvas={this.state.canvas} />
|
|
|
|
<EraserMode canvas={this.state.canvas} />
|
|
|
|
</div>
|
|
|
|
) : null}
|
|
|
|
|
|
|
|
{/* Canvas */}
|
|
|
|
<div className={styles.canvasContainer}>
|
|
|
|
<PaperCanvas canvasRef={this.setCanvas} />
|
|
|
|
</div>
|
|
|
|
</div>
|
2017-07-27 11:45:41 -04:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
2017-07-13 14:03:48 -04:00
|
|
|
|
2017-07-26 20:39:12 -04:00
|
|
|
export default PaintEditorComponent;
|