diff --git a/README.md b/README.md index f716cef3..1961fe75 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,8 @@ Happily accepting pull requests; to edit the core library, modify files in `/src Most contribution (we imagine) would be in the form of API-compatible modules, which need not be directly included. +#### draw() + To add a module to Image Sequencer, it must have the following method; you can wrap an existing module to add them: * `module.draw(image)` @@ -54,6 +56,12 @@ function draw(image) { } ``` +#### Title + +For display in the web-based UI, each module may also have a title like `options.title`. + +#### Module example + See existing module `green-channel` for an example: https://github.com/jywarren/image-sequencer/tree/master/src/modules/GreenChannel.js For help integrating, please open an issue. diff --git a/dist/image-sequencer.css b/dist/image-sequencer.css index 5e28b0f6..ffd9fb97 100644 --- a/dist/image-sequencer.css +++ b/dist/image-sequencer.css @@ -62,7 +62,7 @@ h1 { /* ImageSelect styles */ -.mod-image-select #drop { +.ismod-image-select .mod-drop { border-radius: 4px; background: #efeff6; color: #aaa; @@ -73,10 +73,10 @@ h1 { text-align: center; } -.mod-image-select #drop.hover { +.ismod-image-select .mod-drop.hover { background: #ddd; } -.mod-image-select #drop img { +.ismod-image-select .mod-drop img { width: 100%; } diff --git a/dist/image-sequencer.js b/dist/image-sequencer.js index a8a45305..3e4244c1 100644 --- a/dist/image-sequencer.js +++ b/dist/image-sequencer.js @@ -184103,7 +184103,7 @@ ImageSequencer = function ImageSequencer(options) { modules = require('./Modules'); // if in browser, prompt for an image - if (options.imageSelect || options.inBrowser) addStep('image-select', { selector: "#drop" }); + if (options.imageSelect || options.inBrowser) addStep('image-select'); else if (options.imageUrl) loadImage(imageUrl); // soon, detect local or URL? @@ -184119,17 +184119,23 @@ ImageSequencer = function ImageSequencer(options) { steps.push(module); - if (module.name !== "image-select") { + function defaultSetupModule() { + if (options.ui) module.options.ui = options.ui({ + selector: o.selector, + title: module.options.title + }); + } + + if (name === "image-select") { + + module.setup(); // just set up initial ImageSelect; it has own UI + + } else { // add a default UI, unless the module has one specified if (module.hasOwnProperty('setup')) module.setup(); else { - setup.apply(module); // run default setup() in scope of module (is this right?) - function setup() { - if (module.options.ui) module.options.ui = options.ui({ - selector: o.selector - }); - } + defaultSetupModule.apply(module); // run default setup() in scope of module (is this right?) } var previousStep = steps[steps.length - 2]; @@ -184144,10 +184150,6 @@ ImageSequencer = function ImageSequencer(options) { } } - } else { - - module.setup(); // just set up initial ImageSelect - } // Pre-set the initial output behavior of the final step, @@ -184184,6 +184186,7 @@ ImageSequencer = function ImageSequencer(options) { } return { + options: options, loadImage: loadImage, addStep: addStep, run: run, @@ -184221,13 +184224,13 @@ module.exports = function UserInterface(options) { options.random = options.random || parseInt(Math.random() * (new Date()).getTime() / 1000000); options.uniqueSelector = options.uniqueSelector || options.selector + '-' + options.random; - $(options.container).append('
'); + $(options.container).append(''); options.el = options.el || $('.' + options.uniqueSelector); createLabel(options.el); // method to remove the UI for a given method, and remove the step function display(image) { - options.el.html(image); + options.el.find('.image').html(image); } // method to remove the UI for a given method, and remove the step @@ -184237,8 +184240,7 @@ module.exports = function UserInterface(options) { //function move() {} function createLabel(el) { -console.log("createLabel", module.title) - el.append('Select or drop an image here to begin.