diff --git a/README.md b/README.md index c813056..6a2a04a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ const geometry = new THREE.TorusGeometry(20, 10, 30, 30); const slicer = new SLICER.Slicer(); slicer.setGeometry(geometry); const gcode = await slicer.slice(settings) - .progress(({ done, total, action }) => { + .progress(({ progress: { done, total, action } }) => { const percentage = `${(done / total * 100).toFixed()}%` console.log(action, percentage); }); diff --git a/example/save.js b/example/save.js index 353ef0d..9524c6c 100644 --- a/example/save.js +++ b/example/save.js @@ -17,7 +17,7 @@ jsonLoader.load('models/airplane.json', async geometry => { const slicer = new Slicer().setGeometry(geometry); const gcode = await slicer.slice(settings) - .progress(({ done, total, action }) => { + .progress(({ progress: { done, total, action } }) => { const percentage = `${(done / total * 100).toFixed()}%` document.write(`
${action}, ${percentage}
`); }); diff --git a/src/slicerWorker.js b/src/slicerWorker.js index a761bd4..369e4b3 100644 --- a/src/slicerWorker.js +++ b/src/slicerWorker.js @@ -6,7 +6,7 @@ const loader = new THREE.JSONLoader(); const onProgress = progress => { self.postMessage({ message: 'PROGRESS', - data: progress + data: { progress } }); }