mirror of
https://github.com/publiclab/image-sequencer.git
synced 2025-12-15 12:50:04 +01:00
Updated README.md
This commit is contained in:
55
README.md
55
README.md
@@ -370,10 +370,10 @@ How to define these functions:
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
sequencer.setUI({
|
sequencer.setUI({
|
||||||
onSetup: function() {},
|
onSetup: function(step) {},
|
||||||
onDraw: function() {},
|
onDraw: function(step) {},
|
||||||
onComplete: function(output) {},
|
onComplete: function(step) {},
|
||||||
onRemove: function() {}
|
onRemove: function(step) {}
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -383,18 +383,37 @@ the `setUI` method will only affect the modules added after `setUI` is called.
|
|||||||
|
|
||||||
The `onComplete` event is passed on the output of the module.
|
The `onComplete` event is passed on the output of the module.
|
||||||
|
|
||||||
In the scope of all these events, the following variables are present, which
|
Image Sequencer provides a namespace `step` for the purpose of UI Creation in
|
||||||
may be used in generating the UI:
|
the scope of these definable function. This namespace has the following
|
||||||
* The object `identity`
|
predefined properties:
|
||||||
```
|
|
||||||
identity = {
|
|
||||||
stepName: "Name of the Step",
|
|
||||||
stepID: "A unique ID given to the step",
|
|
||||||
imageName: "The name of the image to which the step is added."
|
|
||||||
}
|
|
||||||
```
|
|
||||||
* The variable `options.inBrowser` which is a Boolean and is `true` if the client is a browser and `false` otherwise.
|
|
||||||
|
|
||||||
Note: `identity.imageName` is the "name" of that particular image. This name can be specified
|
* `step.name` : (String) Name of the step
|
||||||
while loading the image via `sequencer.loadImage("name","SRC")`. If not specified,
|
* `step.ID` : (Number) An ID given to every step of the sequencer, unique throughout.
|
||||||
the name of a loaded image defaults to a name like "image1", "image2", et cetra.
|
* `step.imageName` : (String) Name of the image the step is applied to.
|
||||||
|
* `step.output` : (DataURL String) Output of the step.
|
||||||
|
* `step.inBrowser` : (Boolean) Whether the client is a browser or not
|
||||||
|
|
||||||
|
In addition to these, one might define their own properties, which shall be
|
||||||
|
accessible across all the event scopes of that step.
|
||||||
|
|
||||||
|
For example :
|
||||||
|
|
||||||
|
```js
|
||||||
|
sequencer.setUI({
|
||||||
|
onSetup: function(step){
|
||||||
|
step.image = document.createElement('img');
|
||||||
|
document.body.append(step.image);
|
||||||
|
},
|
||||||
|
onComplete: function(step){
|
||||||
|
step.image.src = step.output;
|
||||||
|
},
|
||||||
|
onRemove: function(step){
|
||||||
|
step.image.remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
Note: `identity.imageName` is the "name" of that particular image. This name can
|
||||||
|
be specified while loading the image via `sequencer.loadImage("name","SRC")`. If
|
||||||
|
not specified, the name of a loaded image defaults to a name like "image1",
|
||||||
|
"image2", et cetra.
|
||||||
|
|||||||
Reference in New Issue
Block a user