widgets: add variable widget
This commit is contained in:
parent
cee4432b80
commit
a58c9bc1d0
5 changed files with 48 additions and 3 deletions
|
|
@ -714,3 +714,6 @@
|
|||
| <h6 id="script_keyBinding">keyBinding<a class="headerlink" href="#script_keyBinding" title="Permanent link">#</a></h6> | `string`|<br/>`array` | <code>""</code> | Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation) |
|
||||
| <h6 id="script_keyRepeat">keyRepeat<a class="headerlink" href="#script_keyRepeat" title="Permanent link">#</a></h6> | `boolean` | <code>true</code> | Set to `false` to prevent keydown repeats when holding the key combo pressed |
|
||||
| <h6 id="script_keyType">keyType<a class="headerlink" href="#script_keyType" title="Permanent link">#</a></h6> | `string` | <code>"keydown"</code> | Determines which key event trigger the script's execution<br/><br/>Choices: `keydown`, `keyup`, `both` |
|
||||
|
||||
??? api "<div id="variable">variable<a class="headerlink" href="#variable" title="Permanent link">#</a></div>"
|
||||
Hold a value.
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ module.exports.widgets = {
|
|||
|
||||
// scripts
|
||||
script: require('./scripts/script'),
|
||||
variable: require('./scripts/variable'),
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +60,7 @@ module.exports.categories = {
|
|||
'Indicators':['led', 'text'],
|
||||
'Pads':['xy','rgb','multixy'],
|
||||
'Sliders':['fader','knob', 'encoder', 'range'],
|
||||
'Scripts':['script'],
|
||||
'Scripts':['script', 'variable'],
|
||||
}
|
||||
|
||||
var defaults = {}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Script extends Widget {
|
|||
|
||||
}, [
|
||||
|
||||
'visible', 'label', 'interaction',
|
||||
'visible', 'interaction',
|
||||
'_geometry', 'left', 'top', 'width', 'height', 'expand',
|
||||
'_style', 'colorBg', 'colorText', 'colorWidget', 'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOn', 'alphaFillOff', 'padding', 'css'
|
||||
|
||||
|
|
|
|||
41
src/client/widgets/scripts/variable.js
Normal file
41
src/client/widgets/scripts/variable.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
var Widget = require('../common/widget'),
|
||||
StaticProperties = require('../mixins/static_properties')
|
||||
|
||||
module.exports = class Variable extends StaticProperties(Widget, {bypass: true, interaction: false, visible: false}) {
|
||||
|
||||
static description() {
|
||||
|
||||
return 'Hold a value.'
|
||||
|
||||
}
|
||||
|
||||
static defaults() {
|
||||
|
||||
return super.defaults({
|
||||
|
||||
|
||||
}, [
|
||||
'visible', 'interaction',
|
||||
'_geometry', 'left', 'top', 'width', 'height', 'expand',
|
||||
'_style', 'colorBg', 'colorText', 'colorWidget', 'colorFill', 'colorStroke', 'alphaStroke', 'alphaFillOn', 'alphaFillOff', 'padding', 'css',
|
||||
'decimals', 'bypass'
|
||||
], {})
|
||||
|
||||
}
|
||||
|
||||
constructor(options) {
|
||||
|
||||
super({...options, html: null})
|
||||
|
||||
}
|
||||
|
||||
|
||||
setValue(v, options={}) {
|
||||
|
||||
this.value = v
|
||||
|
||||
if (options.sync) this.changed(options)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ var widgets = {
|
|||
'Indicators':['led', 'text'],
|
||||
'Pads':['xy','rgb','multixy', 'canvas'],
|
||||
'Sliders':['fader','knob', 'encoder', 'range'],
|
||||
'Scripts':['script'],
|
||||
'Scripts':['script', 'variable'],
|
||||
}
|
||||
for (let k in widgets) {
|
||||
for (let type of widgets[k]) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue