pass more data

This commit is contained in:
casperlamboo 2017-11-13 15:12:59 +01:00
parent f4eaac16ff
commit 6e43994305
2 changed files with 7 additions and 4 deletions

View File

@ -42,7 +42,7 @@ class Settings extends React.Component {
state = _.set(_.cloneDeep(this.state), fieldName, value); state = _.set(_.cloneDeep(this.state), fieldName, value);
break; break;
} }
if (onChange) onChange(state.settings); if (onChange) onChange(state);
if (state) this.setState(state); if (state) this.setState(state);
}; };

View File

@ -69,6 +69,9 @@ class Interface extends React.Component {
controlMode: 'translate', controlMode: 'translate',
isSlicing: false, isSlicing: false,
sliced: false, sliced: false,
printer: printers[defaultPrinter],
quality: quality[defaultQuality],
material: material[defaultMaterial],
settings: _.merge( settings: _.merge(
{}, {},
defaultSettings, defaultSettings,
@ -150,7 +153,7 @@ class Interface extends React.Component {
}; };
onChangeSettings = (settings) => { onChangeSettings = (settings) => {
this.setState({ settings }); this.setState(settings);
}; };
updateDrawRange = (event, value) => { updateDrawRange = (event, value) => {
@ -187,7 +190,7 @@ class Interface extends React.Component {
render() { render() {
const { width, height, classes, onCompleteActions, defaultPrinter, defaultQuality, defaultMaterial } = this.props; const { width, height, classes, onCompleteActions, defaultPrinter, defaultQuality, defaultMaterial } = this.props;
const { sliced, isSlicing, progress, gcode, controlMode, settings } = this.state; const { sliced, isSlicing, progress, gcode, controlMode, settings, printer, quality, material } = this.state;
return ( return (
<div className={classes.container}> <div className={classes.container}>
@ -228,7 +231,7 @@ class Interface extends React.Component {
{sliced && <div className={classes.sliceBar}> {sliced && <div className={classes.sliceBar}>
<RaisedButton className={classes.button} fullWidth onTouchTap={this.reset} primary label="slice again" /> <RaisedButton className={classes.button} fullWidth onTouchTap={this.reset} primary label="slice again" />
{onCompleteActions.map(({ title, callback }, i) => ( {onCompleteActions.map(({ title, callback }, i) => (
<RaisedButton className={classes.button} key={i} fullWidth onTouchTap={() => callback(gcode.gcode, settings)} primary label={title} /> <RaisedButton className={classes.button} key={i} fullWidth onTouchTap={() => callback({ gcode, settings, printer, quality, material })} primary label={title} />
))} ))}
</div>} </div>}
{isSlicing && <div className={classes.overlay}> {isSlicing && <div className={classes.overlay}>