widgets: add variable widget
This commit is contained in:
parent
cee4432b80
commit
a58c9bc1d0
5 changed files with 48 additions and 3 deletions
|
|
@ -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)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue