mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-26 07:24:57 +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 {
|
class Settings extends React.Component {
|
||||||
constructor(props) {
|
static childContextTypes = { state: PropTypes.object, onChange: PropTypes.func };
|
||||||
super(props);
|
static propTypes = {
|
||||||
this.state = {
|
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,
|
settings: props.initialSettings,
|
||||||
printers: props.defaultPrinter,
|
printers: props.defaultPrinter,
|
||||||
quality: props.defaultQuality,
|
quality: props.defaultQuality,
|
||||||
material: props.defaultMaterial
|
material: props.defaultMaterial
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
changeSettings = (fieldName, value) => {
|
changeSettings = (fieldName, value) => {
|
||||||
const { onChange } = this.props;
|
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);
|
export default injectSheet(styles)(Settings);
|
||||||
|
@ -64,6 +64,35 @@ const styles = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
class Interface extends React.Component {
|
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) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
const { defaultPrinter, defaultQuality, defaultMaterial, printers, quality, material, defaultSettings } = props;
|
const { defaultPrinter, defaultQuality, defaultMaterial, printers, quality, material, defaultSettings } = props;
|
||||||
@ -87,7 +116,7 @@ class Interface extends React.Component {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
const { canvas } = this.refs;
|
const { canvas } = this.refs;
|
||||||
const scene = createScene(canvas, this.props, this.state);
|
const scene = createScene(canvas, this.props, this.state);
|
||||||
this.setState(scene);
|
this.setState({ ...scene });
|
||||||
}
|
}
|
||||||
|
|
||||||
resetMesh = () => {
|
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);
|
export default injectSheet(styles)(Interface);
|
||||||
|
Loading…
Reference in New Issue
Block a user