Fix stepping not working.

Use transferable object for sending arraybuffers to workers
This commit is contained in:
j433866 2019-05-16 10:42:07 +01:00
parent d326cad611
commit 0e850b2a85
6 changed files with 47 additions and 32 deletions

View file

@ -69,7 +69,22 @@ class ControlsWaiter {
* Handler for the 'Step through' command. Executes the next step of the recipe.
*/
stepClick() {
this.app.bake(true);
if (this.manager.worker.step) {
// Step has already been clicked so get the data from the output
const activeTab = this.manager.input.getActiveTab();
this.manager.worker.queueInput({
input: this.manager.output.getOutput(activeTab, true),
inputNum: activeTab
});
this.app.progress = this.manager.output.outputs[activeTab].progress;
this.app.bake(true);
} else {
// First click of step, so get the output from the inputWorker
this.manager.input.inputWorker.postMessage({
action: "step",
data: this.manager.input.getActiveTab()
});
}
}