mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-12-23 11:33:49 +01:00
remove progress promise
@mith @peteruithoven
This commit is contained in:
parent
c390cc335a
commit
e4880106f1
@ -17,9 +17,8 @@ const geometry = new THREE.TorusGeometry(20, 10, 30, 30);
|
|||||||
|
|
||||||
const slicer = new SLICER.Slicer();
|
const slicer = new SLICER.Slicer();
|
||||||
slicer.setGeometry(geometry);
|
slicer.setGeometry(geometry);
|
||||||
const gcode = await slicer.slice(settings)
|
const gcode = await slicer.slice(settings, ({ progress: { done, total, action } }) => {
|
||||||
.progress(({ progress: { done, total, action } }) => {
|
|
||||||
const percentage = `${(done / total * 100).toFixed()}%`
|
const percentage = `${(done / total * 100).toFixed()}%`
|
||||||
console.log(action, percentage);
|
console.log(action, percentage);
|
||||||
});
|
}));
|
||||||
```
|
```
|
||||||
|
@ -151,7 +151,6 @@ SystemJS.config({
|
|||||||
],
|
],
|
||||||
map: {
|
map: {
|
||||||
"three": "npm:three@0.83.0",
|
"three": "npm:three@0.83.0",
|
||||||
"progress-promise": "npm:progress-promise@0.0.6",
|
|
||||||
"text": "github:systemjs/plugin-text@0.0.11",
|
"text": "github:systemjs/plugin-text@0.0.11",
|
||||||
"js-yaml": "npm:js-yaml@3.9.0",
|
"js-yaml": "npm:js-yaml@3.9.0",
|
||||||
"clipper-js": "github:Doodle3D/clipper-js@1.0.2",
|
"clipper-js": "github:Doodle3D/clipper-js@1.0.2",
|
||||||
|
@ -10,7 +10,6 @@
|
|||||||
"clipper-js": "github:Doodle3D/clipper-js@1.0.2",
|
"clipper-js": "github:Doodle3D/clipper-js@1.0.2",
|
||||||
"js-yaml": "npm:js-yaml@^3.9.0",
|
"js-yaml": "npm:js-yaml@^3.9.0",
|
||||||
"json": "github:systemjs/plugin-json@^0.1.2",
|
"json": "github:systemjs/plugin-json@^0.1.2",
|
||||||
"progress-promise": "npm:progress-promise@^0.0.6",
|
|
||||||
"text": "github:systemjs/plugin-text@^0.0.11",
|
"text": "github:systemjs/plugin-text@^0.0.11",
|
||||||
"three": "npm:three@0.83.0",
|
"three": "npm:three@0.83.0",
|
||||||
"worker": "github:casperlamboo/plugin-worker@master"
|
"worker": "github:casperlamboo/plugin-worker@master"
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
import * as THREE from 'three';
|
import * as THREE from 'three';
|
||||||
import slice from './sliceActions/slice.js';
|
import slice from './sliceActions/slice.js';
|
||||||
import SlicerWorker from './slicerWorker.js!worker';
|
import SlicerWorker from './slicerWorker.js!worker';
|
||||||
import ProgressPromise from 'progress-promise';
|
|
||||||
|
|
||||||
export default class {
|
export default class {
|
||||||
setMesh(mesh) {
|
setMesh(mesh) {
|
||||||
@ -29,12 +28,12 @@ export default class {
|
|||||||
sliceSync(settings, onprogress) {
|
sliceSync(settings, onprogress) {
|
||||||
return slice(this.geometry, settings, onprogress);
|
return slice(this.geometry, settings, onprogress);
|
||||||
}
|
}
|
||||||
slice(settings) {
|
slice(settings, onprogress) {
|
||||||
if (!this.geometry) {
|
if (!this.geometry) {
|
||||||
throw new Error('Geometry is not set, use Slicer.setGeometry or Slicer.setMesh first');
|
throw new Error('Geometry is not set, use Slicer.setGeometry or Slicer.setMesh first');
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ProgressPromise((resolve, reject, progress) => {
|
return new Promise((resolve, reject) => {
|
||||||
// create the slicer worker
|
// create the slicer worker
|
||||||
const slicerWorker = new SlicerWorker();
|
const slicerWorker = new SlicerWorker();
|
||||||
slicerWorker.onerror = reject;
|
slicerWorker.onerror = reject;
|
||||||
@ -49,7 +48,7 @@ export default class {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'PROGRESS': {
|
case 'PROGRESS': {
|
||||||
progress(data);
|
onprogress(data);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user