mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 03:23:48 +01:00
mov static functions
This commit is contained in:
parent
aef67db205
commit
72c7c91b27
@ -14,15 +14,24 @@ const styles = {
|
||||
};
|
||||
|
||||
class Settings extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
settings: props.initialSettings,
|
||||
printers: props.defaultPrinter,
|
||||
quality: props.defaultQuality,
|
||||
material: props.defaultMaterial
|
||||
};
|
||||
}
|
||||
static childContextTypes = { state: PropTypes.object, onChange: PropTypes.func };
|
||||
static propTypes = {
|
||||
classes: PropTypes.objectOf(PropTypes.string),
|
||||
onChange: PropTypes.func,
|
||||
printers: PropTypes.object.isRequired,
|
||||
defaultPrinter: PropTypes.string.isRequired,
|
||||
quality: PropTypes.object.isRequired,
|
||||
defaultQuality: PropTypes.string.isRequired,
|
||||
material: PropTypes.object.isRequired,
|
||||
defaultMaterial: PropTypes.string.isRequired,
|
||||
initialSettings: PropTypes.object.isRequired
|
||||
};
|
||||
state = {
|
||||
settings: props.initialSettings,
|
||||
printers: props.defaultPrinter,
|
||||
quality: props.defaultQuality,
|
||||
material: props.defaultMaterial
|
||||
};
|
||||
|
||||
changeSettings = (fieldName, value) => {
|
||||
const { onChange } = this.props;
|
||||
@ -141,17 +150,5 @@ class Settings extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
Settings.childContextTypes = { state: PropTypes.object, onChange: PropTypes.func };
|
||||
Settings.propTypes = {
|
||||
classes: PropTypes.objectOf(PropTypes.string),
|
||||
onChange: PropTypes.func,
|
||||
printers: PropTypes.object.isRequired,
|
||||
defaultPrinter: PropTypes.string.isRequired,
|
||||
quality: PropTypes.object.isRequired,
|
||||
defaultQuality: PropTypes.string.isRequired,
|
||||
material: PropTypes.object.isRequired,
|
||||
defaultMaterial: PropTypes.string.isRequired,
|
||||
initialSettings: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
export default injectSheet(styles)(Settings);
|
||||
|
@ -64,6 +64,35 @@ const styles = {
|
||||
};
|
||||
|
||||
class Interface extends React.Component {
|
||||
static propTypes = {
|
||||
geometry(props, propName) {
|
||||
if (!(props[propName].isGeometry || props[propName].isBufferGeometry)) {
|
||||
throw new Error('invalid prop, is not geometry');
|
||||
}
|
||||
},
|
||||
classes: PropTypes.objectOf(PropTypes.string),
|
||||
onCompleteActions: PropTypes.arrayOf(PropTypes.shape({ title: PropTypes.string, callback: PropTypes.func })).isRequired,
|
||||
defaultSettings: PropTypes.object.isRequired,
|
||||
printers: PropTypes.object.isRequired,
|
||||
defaultPrinter: PropTypes.string.isRequired,
|
||||
quality: PropTypes.object.isRequired,
|
||||
defaultQuality: PropTypes.string.isRequired,
|
||||
material: PropTypes.object.isRequired,
|
||||
defaultMaterial: PropTypes.string.isRequired,
|
||||
pixelRatio: PropTypes.number.isRequired
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
defaultSettings: baseSettings,
|
||||
printers: printerSettings,
|
||||
defaultPrinter: 'ultimaker2',
|
||||
quality: qualitySettings,
|
||||
defaultQuality: 'medium',
|
||||
material: materialSettings,
|
||||
defaultMaterial: 'pla',
|
||||
pixelRatio: 1
|
||||
};
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const { defaultPrinter, defaultQuality, defaultMaterial, printers, quality, material, defaultSettings } = props;
|
||||
@ -87,7 +116,7 @@ class Interface extends React.Component {
|
||||
componentDidMount() {
|
||||
const { canvas } = this.refs;
|
||||
const scene = createScene(canvas, this.props, this.state);
|
||||
this.setState(scene);
|
||||
this.setState({ ...scene });
|
||||
}
|
||||
|
||||
resetMesh = () => {
|
||||
@ -243,32 +272,5 @@ class Interface extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
Interface.propTypes = {
|
||||
geometry(props, propName) {
|
||||
if (!(props[propName].isGeometry || props[propName].isBufferGeometry)) {
|
||||
throw new Error('invalid prop, is not geometry');
|
||||
}
|
||||
},
|
||||
classes: PropTypes.objectOf(PropTypes.string),
|
||||
onCompleteActions: PropTypes.arrayOf(PropTypes.shape({ title: PropTypes.string, callback: PropTypes.func })).isRequired,
|
||||
defaultSettings: PropTypes.object.isRequired,
|
||||
printers: PropTypes.object.isRequired,
|
||||
defaultPrinter: PropTypes.string.isRequired,
|
||||
quality: PropTypes.object.isRequired,
|
||||
defaultQuality: PropTypes.string.isRequired,
|
||||
material: PropTypes.object.isRequired,
|
||||
defaultMaterial: PropTypes.string.isRequired,
|
||||
pixelRatio: PropTypes.number.isRequired
|
||||
};
|
||||
Interface.defaultProps = {
|
||||
defaultSettings: baseSettings,
|
||||
printers: printerSettings,
|
||||
defaultPrinter: 'ultimaker2',
|
||||
quality: qualitySettings,
|
||||
defaultQuality: 'medium',
|
||||
material: materialSettings,
|
||||
defaultMaterial: 'pla',
|
||||
pixelRatio: 1
|
||||
};
|
||||
|
||||
export default injectSheet(styles)(Interface);
|
||||
|
Loading…
Reference in New Issue
Block a user