2017-12-19 12:38:58 +01:00
|
|
|
import 'babel-polyfill'
|
2017-11-11 20:23:45 +01:00
|
|
|
import React from 'react';
|
|
|
|
import { Interface } from 'doodle3d-slicer';
|
2017-12-18 16:37:03 +01:00
|
|
|
import doodleURL from '!url-loader!./models/Doodle_2.d3sketch';
|
2017-11-11 20:23:45 +01:00
|
|
|
import { render } from 'react-dom';
|
2017-11-12 16:58:59 +01:00
|
|
|
import MuiThemeProvider from 'material-ui/styles/MuiThemeProvider';
|
|
|
|
import injectTapEventPlugin from 'react-tap-event-plugin';
|
2017-12-14 11:55:14 +01:00
|
|
|
import jss from 'jss';
|
|
|
|
import preset from 'jss-preset-default';
|
|
|
|
import normalize from 'normalize-jss';
|
2017-12-18 16:37:03 +01:00
|
|
|
import JSONToSketchData from 'doodle3d-core/shape/JSONToSketchData';
|
|
|
|
import createSceneData from 'doodle3d-core/d3/createSceneData.js';
|
2017-12-19 12:38:58 +01:00
|
|
|
import { generateExportMesh } from 'doodle3d-core/utils/exportUtils.js';
|
|
|
|
import { Matrix4 } from 'three/src/math/Matrix4.js';
|
2017-11-12 16:58:59 +01:00
|
|
|
|
|
|
|
injectTapEventPlugin();
|
2017-11-12 01:15:38 +01:00
|
|
|
|
2017-12-14 11:55:14 +01:00
|
|
|
jss.setup(preset());
|
|
|
|
jss.createStyleSheet(normalize).attach();
|
|
|
|
jss.createStyleSheet({
|
|
|
|
'@global': {
|
|
|
|
'*': { margin: 0, padding: 0 },
|
|
|
|
'#app, body, html': { height: '100%', fontFamily: 'sans-serif' },
|
|
|
|
body: { overflow: 'auto' },
|
|
|
|
html: { overflow: 'hidden' }
|
|
|
|
}
|
|
|
|
}).attach();
|
2017-11-12 13:08:51 +01:00
|
|
|
|
2017-12-19 12:38:58 +01:00
|
|
|
function init(mesh) {
|
2017-11-12 01:41:09 +01:00
|
|
|
render((
|
2017-11-12 16:58:59 +01:00
|
|
|
<MuiThemeProvider>
|
2017-12-19 12:38:58 +01:00
|
|
|
<Interface mesh={mesh} name="doodle"/>
|
2017-11-12 16:58:59 +01:00
|
|
|
</MuiThemeProvider>
|
2017-11-12 01:41:09 +01:00
|
|
|
), document.getElementById('app'));
|
2017-12-18 16:37:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
fetch(doodleURL)
|
|
|
|
.then(resonse => resonse.json())
|
|
|
|
.then(json => JSONToSketchData(json))
|
|
|
|
.then(file => createSceneData(file))
|
2017-12-19 12:38:58 +01:00
|
|
|
.then(sketch => generateExportMesh(sketch, { offsetSingleWalls: false, matrix: new Matrix4() }))
|
2017-12-18 16:37:03 +01:00
|
|
|
.then(init);
|