From f5442c307a0f9cfae24f1b2a4b172269feba61ea Mon Sep 17 00:00:00 2001 From: j433866 Date: Fri, 10 May 2019 13:45:27 +0100 Subject: [PATCH] Only set the input of the active input if the progress has changed. Autobake when the input loads instead of when all load. --- src/web/InputWaiter.mjs | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/web/InputWaiter.mjs b/src/web/InputWaiter.mjs index 980dc181..d7871c41 100644 --- a/src/web/InputWaiter.mjs +++ b/src/web/InputWaiter.mjs @@ -419,13 +419,17 @@ class InputWaiter { * Updates the displayed input progress for a file * * @param {number} inputNum - * @param {number} progress + * @param {number | string} progress */ updateFileProgress(inputNum, progress) { const activeTab = this.getActiveTab(); if (inputNum !== activeTab) return; const fileLoaded = document.getElementById("input-file-loaded"); + let oldProgress = fileLoaded.textContent; + if (oldProgress !== "Error") { + oldProgress = parseInt(oldProgress.replace("%", ""), 10); + } if (progress === "error") { fileLoaded.textContent = "Error"; fileLoaded.style.color = "#FF0000"; @@ -434,12 +438,12 @@ class InputWaiter { fileLoaded.style.color = ""; } - if (progress === 100) { + if (progress === 100 && progress !== oldProgress) { this.inputWorker.postMessage({ action: "setInput", data: { inputNum: inputNum, - silent: true + silent: false } }); } @@ -801,15 +805,7 @@ class InputWaiter { }); }.bind(this), 100); } - - if (loaded === total) { - this.app.autoBake(); - } } - // displayTabInfo - // simple getInput for each tab - - // displayFilePreview /** * Create a tab element for the input tab bar