mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-26 15:34:57 +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 THREE from 'three.js';
|
||||||
import slice from './sliceActions/slice.js';
|
import slice from './sliceActions/slice.js';
|
||||||
import SliceWorker from './sliceActions/sliceWorker.js!worker';
|
import SlicerWorker from './slicerWorker.js!worker';
|
||||||
|
|
||||||
export default class {
|
export default class {
|
||||||
setMesh(mesh) {
|
setMesh(mesh) {
|
||||||
@ -34,26 +34,26 @@ export default class {
|
|||||||
return slice(this.geometry, settings);
|
return slice(this.geometry, settings);
|
||||||
}
|
}
|
||||||
slice(settings) {
|
slice(settings) {
|
||||||
const sliceWorker = new SliceWorker();
|
const slicerWorker = new SlicerWorker();
|
||||||
|
|
||||||
const geometry = this.geometry.toJSON();
|
const geometry = this.geometry.toJSON();
|
||||||
const { config } = settings;
|
const { config } = settings;
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
sliceWorker.onerror = reject;
|
slicerWorker.onerror = reject;
|
||||||
|
|
||||||
sliceWorker.addEventListener('message', (event) => {
|
slicerWorker.addEventListener('message', (event) => {
|
||||||
const { message, data } = event.data;
|
const { message, data } = event.data;
|
||||||
switch (message) {
|
switch (message) {
|
||||||
case 'SLICE': {
|
case 'SLICE': {
|
||||||
sliceWorker.terminate();
|
slicerWorker.terminate();
|
||||||
resolve(data.gcode);
|
resolve(data.gcode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
sliceWorker.postMessage({
|
slicerWorker.postMessage({
|
||||||
message: 'SLICE',
|
message: 'SLICE',
|
||||||
data: { geometry, config }
|
data: { geometry, config }
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Settings from '../Settings.js';
|
import Settings from './Settings.js';
|
||||||
import slice from './slice.js';
|
import slice from './sliceActions/slice.js';
|
||||||
import THREE from 'three.js';
|
import THREE from 'three.js';
|
||||||
|
|
||||||
const loader = new THREE.JSONLoader();
|
const loader = new THREE.JSONLoader();
|
Loading…
Reference in New Issue
Block a user