mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-22 13:37:58 +01:00
rename sliceWorker to slicerWorker
This commit is contained in:
parent
f4db432e24
commit
6af54e2362
@ -1,6 +1,6 @@
|
||||
import THREE from 'three.js';
|
||||
import slice from './sliceActions/slice.js';
|
||||
import SliceWorker from './sliceActions/sliceWorker.js!worker';
|
||||
import SlicerWorker from './slicerWorker.js!worker';
|
||||
|
||||
export default class {
|
||||
setMesh(mesh) {
|
||||
@ -34,26 +34,26 @@ export default class {
|
||||
return slice(this.geometry, settings);
|
||||
}
|
||||
slice(settings) {
|
||||
const sliceWorker = new SliceWorker();
|
||||
const slicerWorker = new SlicerWorker();
|
||||
|
||||
const geometry = this.geometry.toJSON();
|
||||
const { config } = settings;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
sliceWorker.onerror = reject;
|
||||
slicerWorker.onerror = reject;
|
||||
|
||||
sliceWorker.addEventListener('message', (event) => {
|
||||
slicerWorker.addEventListener('message', (event) => {
|
||||
const { message, data } = event.data;
|
||||
switch (message) {
|
||||
case 'SLICE': {
|
||||
sliceWorker.terminate();
|
||||
slicerWorker.terminate();
|
||||
resolve(data.gcode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
sliceWorker.postMessage({
|
||||
slicerWorker.postMessage({
|
||||
message: 'SLICE',
|
||||
data: { geometry, config }
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
import Settings from '../Settings.js';
|
||||
import slice from './slice.js';
|
||||
import Settings from './Settings.js';
|
||||
import slice from './sliceActions/slice.js';
|
||||
import THREE from 'three.js';
|
||||
|
||||
const loader = new THREE.JSONLoader();
|
Loading…
Reference in New Issue
Block a user