mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-13 03:40:03 +01:00
options accessible via step, implemented options in demo
This commit is contained in:
43
dist/image-sequencer.js
vendored
43
dist/image-sequencer.js
vendored
@@ -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,
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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++) {
|
||||
|
||||
@@ -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};
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
"min": 0,
|
||||
"max": 4
|
||||
},
|
||||
"Fx": {
|
||||
"Fy": {
|
||||
"type": "float",
|
||||
"desc": "Fy parameter",
|
||||
"default": 0,
|
||||
|
||||
Reference in New Issue
Block a user