From ddbdc0cf765e70113cef030ce8b0e93bcb212142 Mon Sep 17 00:00:00 2001 From: Sindarius Date: Fri, 13 Nov 2020 14:32:15 -0600 Subject: [PATCH] Fixed an issue with a promise not resolving Fixed an issue with a promise not resolving which would block the ability to change render quality or load the current running job. --- GCodeViewer/GCodeViewer.vue | 29 +++++++---------------------- GCodeViewer/viewer/gcodeviewer.js | 5 ++++- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/GCodeViewer/GCodeViewer.vue b/GCodeViewer/GCodeViewer.vue index 44fbb88..4eb22a3 100644 --- a/GCodeViewer/GCodeViewer.vue +++ b/GCodeViewer/GCodeViewer.vue @@ -4,7 +4,7 @@ Reset View Reload View - Load Current Job + Load Current Job Clear Scene @@ -53,20 +53,6 @@

Background

- -

Render Mode (Disabled)

- - Line - 3D - Point - -

Render n-th row (Disabled)

- - 1 - 2 - 3 - -
@@ -113,7 +99,6 @@ showCursor: false, showTravelLines: false, selectedFile: '', - renderMode: 1, nthRow: 1, renderQuality: 0, debugVisible: false, @@ -134,7 +119,11 @@ ...mapState('machine/model', ['job', 'move', 'state']), isJobRunning: (state) => state.state.status === StatusType.simulating || state.state.status === StatusType.processing, visualizingCurrentJob: function (state) { - return state.job.file.fileName === this.selectedFile; + try { + return state.job.file.fileName === this.selectedFile; + } catch { + return false; + } }, filePosition: (state) => state.job.filePosition, fileSize: (state) => state.job.file.size, @@ -166,7 +155,6 @@ this.extruderColors = viewer.getExtruderColors(); this.backgroundColor = viewer.getBackgroundColor(); this.progressColor = viewer.getProgressColor(); - this.viewModelEvent = async (path) => { this.selectedFile = path; this.loading = true; @@ -305,14 +293,11 @@ let progressPercent = newValue / this.fileSize; viewer.updatePrintProgress(progressPercent); }, - renderMode: function (newValue) { - viewer.gcodeProcessor.renderVersion = newValue; - this.reloadviewer(); - }, nthRow: function (newValue) { viewer.gcodeProcessor.everyNthRow = newValue; }, renderQuality: function (newValue) { + console.log(newValue); if (viewer.renderQuality !== newValue) { viewer.updateRenderQuality(newValue); this.reloadviewer(); diff --git a/GCodeViewer/viewer/gcodeviewer.js b/GCodeViewer/viewer/gcodeviewer.js index 7e5202d..713bb96 100644 --- a/GCodeViewer/viewer/gcodeviewer.js +++ b/GCodeViewer/viewer/gcodeviewer.js @@ -373,6 +373,7 @@ export default class { }); } else { this.processFile(this.fileData); + resolve(); } }); } @@ -467,7 +468,9 @@ export default class { } updateRenderQuality(renderQuality) { this.renderQuality = renderQuality; - localStorage.setItem('renderQuality', renderQuality); + if (localStorage) { + localStorage.setItem('renderQuality', renderQuality); + } } registerClipIgnore(mesh) { let that = this;