mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-19 04:27:55 +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();
|
||||
slicer.setGeometry(geometry);
|
||||
const gcode = await slicer.slice(settings)
|
||||
.progress(({ progress: { done, total, action } }) => {
|
||||
const percentage = `${(done / total * 100).toFixed()}%`
|
||||
console.log(action, percentage);
|
||||
});
|
||||
const gcode = await slicer.slice(settings, ({ progress: { done, total, action } }) => {
|
||||
const percentage = `${(done / total * 100).toFixed()}%`
|
||||
console.log(action, percentage);
|
||||
}));
|
||||
```
|
||||
|
@ -151,7 +151,6 @@ SystemJS.config({
|
||||
],
|
||||
map: {
|
||||
"three": "npm:three@0.83.0",
|
||||
"progress-promise": "npm:progress-promise@0.0.6",
|
||||
"text": "github:systemjs/plugin-text@0.0.11",
|
||||
"js-yaml": "npm:js-yaml@3.9.0",
|
||||
"clipper-js": "github:Doodle3D/clipper-js@1.0.2",
|
||||
|
@ -10,7 +10,6 @@
|
||||
"clipper-js": "github:Doodle3D/clipper-js@1.0.2",
|
||||
"js-yaml": "npm:js-yaml@^3.9.0",
|
||||
"json": "github:systemjs/plugin-json@^0.1.2",
|
||||
"progress-promise": "npm:progress-promise@^0.0.6",
|
||||
"text": "github:systemjs/plugin-text@^0.0.11",
|
||||
"three": "npm:three@0.83.0",
|
||||
"worker": "github:casperlamboo/plugin-worker@master"
|
||||
|
@ -1,7 +1,6 @@
|
||||
import * as THREE from 'three';
|
||||
import slice from './sliceActions/slice.js';
|
||||
import SlicerWorker from './slicerWorker.js!worker';
|
||||
import ProgressPromise from 'progress-promise';
|
||||
|
||||
export default class {
|
||||
setMesh(mesh) {
|
||||
@ -29,12 +28,12 @@ export default class {
|
||||
sliceSync(settings, onprogress) {
|
||||
return slice(this.geometry, settings, onprogress);
|
||||
}
|
||||
slice(settings) {
|
||||
slice(settings, onprogress) {
|
||||
if (!this.geometry) {
|
||||
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
|
||||
const slicerWorker = new SlicerWorker();
|
||||
slicerWorker.onerror = reject;
|
||||
@ -49,7 +48,7 @@ export default class {
|
||||
break;
|
||||
}
|
||||
case 'PROGRESS': {
|
||||
progress(data);
|
||||
onprogress(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user