Completed the addStep issue.

This commit is contained in:
Chinmay Pandhare
2017-03-13 20:17:23 +05:30
parent f2e80620cf
commit aba3ba1392
4 changed files with 47 additions and 1 deletions

View File

@@ -184159,6 +184159,25 @@ ImageSequencer = function ImageSequencer(options) {
// if in browser, prompt for an image
if (options.imageSelect || options.inBrowser) addStep('image-select');
// {
// console.log('adding step "image-select"');
// o = {};
// o.name = 'image-select';
// o.selector = 'ismod-image-select';
// o.container = o.container || options.selector;
//
// var module = modules['image-select'](o);
//
// steps.push(module);
//
// module.setup();
//
// // Pre-set the initial output behavior of the final step,
// // which will be changed if an additional step is added.
// module.options.output = function output(image) {
// if (module.options.ui && module.options.ui.display) module.options.ui.display(image);
// }
// }
else if (options.imageUrl) loadImage(imageUrl);
// soon, detect local or URL?
@@ -184198,6 +184217,9 @@ ImageSequencer = function ImageSequencer(options) {
if (previousStep) {
// connect output of last step to input of this step
previousStep.options.output = function output(image) {
if (sequencer.steps[0].options.initial_image) {
options.initial_image = sequencer.steps[0].options.initial_image;
}
log('running module "' + name + '"');
// display the image in any available ui
if (previousStep.options.ui && previousStep.options.ui.display) previousStep.options.ui.display(image);
@@ -184409,6 +184431,7 @@ module.exports = function ImageSelect(options) {
// this module is unique because it creates the image
function draw(image) {
el.html(image);
options.initial_image = image;
if (options.output) options.output(image);
}

View File

@@ -74,7 +74,7 @@
$('.add-step').click(function(e) {
e.preventDefault();
sequencer.addStep($('.select-module').val());
sequencer.run(sequencer.initial_image); // later we might only run this step, if we can fetch the image output from the previous
sequencer.run(sequencer.options.initial_image); // later we might only run this step, if we can fetch the image output from the previous
});

View File

@@ -13,6 +13,25 @@ ImageSequencer = function ImageSequencer(options) {
// if in browser, prompt for an image
if (options.imageSelect || options.inBrowser) addStep('image-select');
// {
// console.log('adding step "image-select"');
// o = {};
// o.name = 'image-select';
// o.selector = 'ismod-image-select';
// o.container = o.container || options.selector;
//
// var module = modules['image-select'](o);
//
// steps.push(module);
//
// module.setup();
//
// // Pre-set the initial output behavior of the final step,
// // which will be changed if an additional step is added.
// module.options.output = function output(image) {
// if (module.options.ui && module.options.ui.display) module.options.ui.display(image);
// }
// }
else if (options.imageUrl) loadImage(imageUrl);
// soon, detect local or URL?
@@ -52,6 +71,9 @@ ImageSequencer = function ImageSequencer(options) {
if (previousStep) {
// connect output of last step to input of this step
previousStep.options.output = function output(image) {
if (sequencer.steps[0].options.initial_image) {
options.initial_image = sequencer.steps[0].options.initial_image;
}
log('running module "' + name + '"');
// display the image in any available ui
if (previousStep.options.ui && previousStep.options.ui.display) previousStep.options.ui.display(image);

View File

@@ -68,6 +68,7 @@ module.exports = function ImageSelect(options) {
// this module is unique because it creates the image
function draw(image) {
el.html(image);
options.initial_image = image;
if (options.output) options.output(image);
}