mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-16 13:20:01 +01:00
thorough rework of API
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
module.exports = function ImageSelect(options) {
|
||||
|
||||
//window.$ = window.jQuery = require('jquery');
|
||||
if (!window.hasOwnProperty('$')) window.$ = window.jQuery = require('jquery');
|
||||
|
||||
options = options || {};
|
||||
options.selector = options.selector || "#drop";
|
||||
@@ -12,11 +12,11 @@ module.exports = function ImageSelect(options) {
|
||||
options.ui = options.ui || {};
|
||||
options.ui.el = options.ui.el || $(options.selector);
|
||||
|
||||
if (options.ui.el.length === 0) console.log('No UI element found with given selector: ', options.selector);
|
||||
|
||||
var image,
|
||||
el = options.ui.el;
|
||||
|
||||
console.log(el,$('body'));
|
||||
|
||||
function setup() {
|
||||
|
||||
// CSS UI
|
||||
@@ -50,7 +50,7 @@ console.log(el,$('body'));
|
||||
el.html(image); // may be redundant
|
||||
|
||||
// this is done once per image:
|
||||
options.onComplete(image);
|
||||
options.output(image);
|
||||
}
|
||||
reader.readAsDataURL(f);
|
||||
|
||||
@@ -69,8 +69,10 @@ console.log(el,$('body'));
|
||||
|
||||
}
|
||||
|
||||
function draw(_image) {
|
||||
if (options.onComplete) options.onComplete(image);
|
||||
// this module is unique because it creates the image
|
||||
function draw(image) {
|
||||
options.ui.display(image);
|
||||
if (options.output) options.output(image);
|
||||
}
|
||||
|
||||
function get() {
|
||||
|
||||
Reference in New Issue
Block a user