options accessible via step, implemented options in demo

This commit is contained in:
Chinmay Pandhare
2017-08-15 14:27:38 +05:30
parent 963129d513
commit 782e60269e
7 changed files with 79 additions and 30 deletions

View File

@@ -27866,7 +27866,8 @@ function AddStep(ref, image, name, o) {
ID: o.number,
imageName: o.image,
inBrowser: ref.options.inBrowser,
ui: ref.options.ui
ui: ref.options.ui,
options: o
};
var UI = ref.events;
var module = ref.modules[name][0](o,UI);
@@ -28341,7 +28342,8 @@ function InsertStep(ref, image, index, name, o) {
ID: o.number,
imageName: o.image,
inBrowser: ref.options.inBrowser,
ui: ref.options.ui
ui: ref.options.ui,
options: o
};
var UI = ref.events;
var module = ref.modules[name][0](o,UI);
@@ -28653,11 +28655,16 @@ module.exports = function Crop(input,options,callback) {
var getPixels = require('get-pixels'),
savePixels = require('save-pixels');
options.x = parseInt(options.x) || 0;
options.y = parseInt(options.y) || 0;
getPixels(input.src,function(err,pixels){
var ox = parseInt(options.x) || 0;
var oy = parseInt(options.y) || 0;
var w = parseInt(options.w) || Math.floor(0.5*pixels.shape[0]);
var h = parseInt(options.h) || Math.floor(0.5*pixels.shape[1]);
options.w = parseInt(options.w) || Math.floor(0.5*pixels.shape[0]);
options.h = parseInt(options.h) || Math.floor(0.5*pixels.shape[1]);
var ox = options.x;
var oy = options.y;
var w = options.w;
var h = options.h;
var iw = pixels.shape[0]; //Width of Original Image
var newarray = new Uint8Array(4*w*h);
for (var n = oy; n < oy + h; n++) {
@@ -28922,13 +28929,21 @@ module.exports = function DoNothing(options,UI) {
selector: "#image-sequencer-canvas"
});
distorter.lens.a = parseFloat(options.a) || distorter.lens.a;
distorter.lens.b = parseFloat(options.b) || distorter.lens.b;
distorter.lens.Fx = parseFloat(options.Fx) || distorter.lens.Fx;
distorter.lens.Fy = parseFloat(options.Fy) || distorter.lens.Fy;
distorter.lens.scale = parseFloat(options.scale) || distorter.lens.scale;
distorter.fov.x = parseFloat(options.x) || distorter.fov.x;
distorter.fov.y = parseFloat(options.y) || distorter.fov.y;
options.a = parseFloat(options.a) || distorter.lens.a;
options.b = parseFloat(options.b) || distorter.lens.b;
options.Fx = parseFloat(options.Fx) || distorter.lens.Fx;
options.Fy = parseFloat(options.Fy) || distorter.lens.Fy;
options.scale = parseFloat(options.scale) || distorter.lens.scale;
options.x = parseFloat(options.x) || distorter.fov.x;
options.y = parseFloat(options.y) || distorter.fov.y;
distorter.lens.a = options.a;
distorter.lens.b = options.b;
distorter.lens.Fx = options.Fx;
distorter.lens.Fy = options.Fy;
distorter.lens.scale = options.scale;
distorter.fov.x = options.x;
distorter.fov.y = options.y;
distorter.setImage(input.src,function(){
step.output = {src: canvas.toDataURL(), format: input.format};
@@ -28973,7 +28988,7 @@ module.exports={
"min": 0,
"max": 4
},
"Fx": {
"Fy": {
"type": "float",
"desc": "Fy parameter",
"default": 0,

View File

@@ -96,8 +96,6 @@
</div>\
<div class="c rh details">\
<div class="r"><h4>'+step.name+'</h4></div>\
<div class="r nomargin">Width: x</div>\
<div class="r nomargin">Height: y</div>\
</div>\
</div>\
';
@@ -109,6 +107,17 @@
step.ui = step.ui.querySelector('div.r');
step.imgElement = step.ui.querySelector('img');
if(sequencer.modulesInfo().hasOwnProperty(step.name)) {
var inputs = sequencer.modulesInfo(step.name).inputs;
for (var i in inputs) {
var div = document.createElement('div');
div.className = "r nomargin";
div.setAttribute('name',i);
div.innerHTML = i + ": " + "<span></span>";
step.ui.querySelector('div.details').appendChild(div);
}
}
if(step.name != "load-image")
step.ui.querySelector('div.details').appendChild(
parser.parseFromString(removebutton,'text/html')
@@ -119,7 +128,17 @@
},
onComplete: function(step) {
step.imgElement.src = step.output;
if(sequencer.modulesInfo().hasOwnProperty(step.name)) {
var inputs = sequencer.modulesInfo(step.name).inputs;
for (var i in inputs) {
step.ui.querySelector('div[name="'+i+'"] span')
.innerHTML = step.options[i];
}
}
},
onRemove: function(step) {

View File

@@ -14,7 +14,8 @@ function AddStep(ref, image, name, o) {
ID: o.number,
imageName: o.image,
inBrowser: ref.options.inBrowser,
ui: ref.options.ui
ui: ref.options.ui,
options: o
};
var UI = ref.events;
var module = ref.modules[name][0](o,UI);

View File

@@ -15,7 +15,8 @@ function InsertStep(ref, image, index, name, o) {
ID: o.number,
imageName: o.image,
inBrowser: ref.options.inBrowser,
ui: ref.options.ui
ui: ref.options.ui,
options: o
};
var UI = ref.events;
var module = ref.modules[name][0](o,UI);

View File

@@ -3,11 +3,16 @@ module.exports = function Crop(input,options,callback) {
var getPixels = require('get-pixels'),
savePixels = require('save-pixels');
options.x = parseInt(options.x) || 0;
options.y = parseInt(options.y) || 0;
getPixels(input.src,function(err,pixels){
var ox = parseInt(options.x) || 0;
var oy = parseInt(options.y) || 0;
var w = parseInt(options.w) || Math.floor(0.5*pixels.shape[0]);
var h = parseInt(options.h) || Math.floor(0.5*pixels.shape[1]);
options.w = parseInt(options.w) || Math.floor(0.5*pixels.shape[0]);
options.h = parseInt(options.h) || Math.floor(0.5*pixels.shape[1]);
var ox = options.x;
var oy = options.y;
var w = options.w;
var h = options.h;
var iw = pixels.shape[0]; //Width of Original Image
var newarray = new Uint8Array(4*w*h);
for (var n = oy; n < oy + h; n++) {

View File

@@ -28,13 +28,21 @@ module.exports = function DoNothing(options,UI) {
selector: "#image-sequencer-canvas"
});
distorter.lens.a = parseFloat(options.a) || distorter.lens.a;
distorter.lens.b = parseFloat(options.b) || distorter.lens.b;
distorter.lens.Fx = parseFloat(options.Fx) || distorter.lens.Fx;
distorter.lens.Fy = parseFloat(options.Fy) || distorter.lens.Fy;
distorter.lens.scale = parseFloat(options.scale) || distorter.lens.scale;
distorter.fov.x = parseFloat(options.x) || distorter.fov.x;
distorter.fov.y = parseFloat(options.y) || distorter.fov.y;
options.a = parseFloat(options.a) || distorter.lens.a;
options.b = parseFloat(options.b) || distorter.lens.b;
options.Fx = parseFloat(options.Fx) || distorter.lens.Fx;
options.Fy = parseFloat(options.Fy) || distorter.lens.Fy;
options.scale = parseFloat(options.scale) || distorter.lens.scale;
options.x = parseFloat(options.x) || distorter.fov.x;
options.y = parseFloat(options.y) || distorter.fov.y;
distorter.lens.a = options.a;
distorter.lens.b = options.b;
distorter.lens.Fx = options.Fx;
distorter.lens.Fy = options.Fy;
distorter.lens.scale = options.scale;
distorter.fov.x = options.x;
distorter.fov.y = options.y;
distorter.setImage(input.src,function(){
step.output = {src: canvas.toDataURL(), format: input.format};

View File

@@ -22,7 +22,7 @@
"min": 0,
"max": 4
},
"Fx": {
"Fy": {
"type": "float",
"desc": "Fy parameter",
"default": 0,