mirror of
https://github.com/Doodle3D/Doodle3D-Core.git
synced 2024-12-22 19:13:49 +01:00
also allow for sketch data
This commit is contained in:
parent
7d707894cc
commit
f0c4af7b35
@ -14,22 +14,24 @@ class DoodlePreview extends React.Component {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount(prevProps) {
|
async componentDidMount() {
|
||||||
JSONToSketchData(this.props.docData).then((sketchData) => {
|
let { docData, sketchData } = this.props;
|
||||||
const { canvas } = this.refs;
|
|
||||||
const { width, height, pixelRatio } = this.props
|
|
||||||
|
|
||||||
const sceneData = createSceneData(sketchData);
|
if (docData) sketchData = await JSONToSketchData(this.props.docData);
|
||||||
|
|
||||||
const scene = createScene(sceneData, canvas);
|
const { canvas } = this.refs;
|
||||||
this.setState({ scene });
|
const { width, height, pixelRatio } = this.props
|
||||||
|
|
||||||
scene.setSize(width, height, pixelRatio);
|
const sceneData = createSceneData(sketchData);
|
||||||
scene.render();
|
|
||||||
|
|
||||||
this.editorControls = new THREE.EditorControls(scene.camera, canvas);
|
const scene = createScene(sceneData, canvas);
|
||||||
this.editorControls.addEventListener('change', () => scene.render());
|
this.setState({ scene });
|
||||||
});
|
|
||||||
|
scene.setSize(width, height, pixelRatio);
|
||||||
|
scene.render();
|
||||||
|
|
||||||
|
this.editorControls = new THREE.EditorControls(scene.camera, canvas);
|
||||||
|
this.editorControls.addEventListener('change', () => scene.render());
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
|
Loading…
Reference in New Issue
Block a user