mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2025-01-05 17:33:49 +01:00
simplify progress updating
by @companje
This commit is contained in:
parent
e09ed8012c
commit
e091f425a1
@ -171,7 +171,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
|||||||
const { gcode } = await sliceGeometry(settings, mesh.geometry, mesh.material, matrix, false, false, ({ progress }) => {
|
const { gcode } = await sliceGeometry(settings, mesh.geometry, mesh.material, matrix, false, false, ({ progress }) => {
|
||||||
updateProgress({
|
updateProgress({
|
||||||
action: progress.action,
|
action: progress.action,
|
||||||
percentage: currentStep / steps + progress.done / progress.total / steps
|
percentage: (currentStep + progress.done / progress.total) / steps
|
||||||
});
|
});
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
throw { message: `error during slicing: ${error.message}`, code: 2 };
|
throw { message: `error during slicing: ${error.message}`, code: 2 };
|
||||||
@ -204,7 +204,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
|||||||
await fetch(`http://${settings.ip}/upload`, { method: 'POST', body, mode: 'no-cors' }, (progress) => {
|
await fetch(`http://${settings.ip}/upload`, { method: 'POST', body, mode: 'no-cors' }, (progress) => {
|
||||||
updateProgress({
|
updateProgress({
|
||||||
action: 'Uploading',
|
action: 'Uploading',
|
||||||
percentage: currentStep / steps + progress.loaded / progress.total / steps
|
percentage: (currentStep + progress.loaded / progress.total) / steps
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
@ -235,7 +235,7 @@ export async function slice(target, name, mesh, settings, updateProgress) {
|
|||||||
await fetchProgress(reservation.url, { method: 'POST', body }, (progress) => {
|
await fetchProgress(reservation.url, { method: 'POST', body }, (progress) => {
|
||||||
updateProgress({
|
updateProgress({
|
||||||
action: 'Uploading',
|
action: 'Uploading',
|
||||||
percentage: currentStep / steps + progress.loaded / progress.total / steps
|
percentage: (currentStep + progress.loaded / progress.total) / steps
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
currentStep ++;
|
currentStep ++;
|
||||||
|
Loading…
Reference in New Issue
Block a user