Patch for UI

This commit is contained in:
Chinmay Pandhare
2017-07-28 18:01:22 +05:30
parent ec4459309b
commit 2888c2d735
4 changed files with 70 additions and 36 deletions

View File

@@ -1,17 +1,20 @@
/*
* Default UI for each image-sequencer module
*/
module.exports = function UserInterface(UI,options) {
module.exports = function UserInterface(newUI = {},options) {
var UI = newUI;
return function userInterface(identity) {
var UI = UI || {};
identity.ui = options.ui;
identity.inBrowser = options.inBrowser;
UI.onSetup = UI.onSetup || function() {
if(options.ui == false) {
UI.onSetup = UI.onSetup || function(identity) {
if(identity.ui == false) {
// No UI
}
else if(options.inBrowser) {
else if(identity.inBrowser) {
// Create and append an HTML Element
console.log("Added Step \""+identity.stepName+"\" to \""+identity.imageName+"\".");
}
@@ -22,11 +25,11 @@ module.exports = function UserInterface(UI,options) {
}
}
UI.onDraw = UI.onDraw || function() {
if (options.ui == false) {
UI.onDraw = UI.onDraw || function(identity) {
if (identity.ui == false) {
// No UI
}
else if(options.inBrowser) {
else if(identity.inBrowser) {
// Overlay a loading spinner
console.log("Drawing Step \""+identity.stepName+"\" on \""+identity.imageName+"\".");
}
@@ -36,11 +39,11 @@ module.exports = function UserInterface(UI,options) {
}
}
UI.onComplete = UI.onComplete || function(output) {
if (options.ui == false) {
UI.onComplete = UI.onComplete || function(identity,output) {
if (identity.ui == false) {
// No UI
}
else if(options.inBrowser) {
else if(identity.inBrowser) {
// Update the DIV Element
// Hide the laoding spinner
console.log("Drawn Step \""+identity.stepName+"\" on \""+identity.imageName+"\".");
@@ -51,11 +54,11 @@ module.exports = function UserInterface(UI,options) {
}
}
UI.onRemove = UI.onRemove || function(callback) {
if(options.ui == false){
UI.onRemove = UI.onRemove || function(identity) {
if(identity.ui == false){
// No UI
}
else if(options.inBrowser) {
else if(identity.inBrowser) {
// Remove the DIV Element
console.log("Removing Step \""+identity.stepName+"\" of \""+identity.imageName+"\".");
}