mutli[toggle|push] compatible with plot
This commit is contained in:
parent
c7ed97e282
commit
d435d067ae
3 changed files with 74 additions and 0 deletions
|
|
@ -33,6 +33,8 @@ module.exports.create = function(widgetData,container) {
|
|||
`),
|
||||
$document = $(document)
|
||||
|
||||
widget.value = []
|
||||
|
||||
for (var i=0;i<widgetData.matrix[0]*widgetData.matrix[1];i++) {
|
||||
var data = {
|
||||
type:'push',
|
||||
|
|
@ -48,8 +50,23 @@ module.exports.create = function(widgetData,container) {
|
|||
element[0].setAttribute('style',`width:${100/widgetData.matrix[0]}%`)
|
||||
element[0].classList.add('not-editable')
|
||||
|
||||
widget.value[i] = widgetData.off
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
widget.on('sync',function(e,id,w){
|
||||
if (id==widgetData.id) return
|
||||
widget.value[w.parent().index()] = w.getValue()
|
||||
widget.trigger('sync',[widgetData.id,widget])
|
||||
})
|
||||
|
||||
|
||||
widget.getValue = function(){
|
||||
return widget.value
|
||||
}
|
||||
|
||||
widget.delegateDrag()
|
||||
|
||||
return widget
|
||||
|
|
|
|||
|
|
@ -33,6 +33,8 @@ module.exports.create = function(widgetData,container) {
|
|||
`),
|
||||
$document = $(document)
|
||||
|
||||
widget.value = []
|
||||
|
||||
for (var i=0;i<widgetData.matrix[0]*widgetData.matrix[1];i++) {
|
||||
var data = {
|
||||
type:'toggle',
|
||||
|
|
@ -48,8 +50,23 @@ module.exports.create = function(widgetData,container) {
|
|||
element[0].setAttribute('style',`width:${100/widgetData.matrix[0]}%`)
|
||||
element[0].classList.add('not-editable')
|
||||
|
||||
widget.value[i] = widgetData.off
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
widget.on('sync',function(e,id,w){
|
||||
if (id==widgetData.id) return
|
||||
widget.value[w.parent().index()] = w.getValue()
|
||||
widget.trigger('sync',[widgetData.id,widget])
|
||||
})
|
||||
|
||||
|
||||
widget.getValue = function(){
|
||||
return widget.value
|
||||
}
|
||||
|
||||
widget.delegateDrag()
|
||||
|
||||
return widget
|
||||
|
|
|
|||
|
|
@ -227,6 +227,46 @@
|
|||
},
|
||||
"logScaleX": false,
|
||||
"logScaleY": false
|
||||
},
|
||||
{
|
||||
"type": "multitoggle",
|
||||
"id": "multitoggle_1",
|
||||
"label": "mutlitoggle_1",
|
||||
"left": 552,
|
||||
"top": 0,
|
||||
"width": 209,
|
||||
"height": 228,
|
||||
"css": "",
|
||||
"precision": 2,
|
||||
"path": "/multifader_2",
|
||||
"target": [],
|
||||
"matrix": [
|
||||
2,
|
||||
2
|
||||
],
|
||||
"on": 1,
|
||||
"off": 0
|
||||
},
|
||||
{
|
||||
"type": "plot",
|
||||
"left": 552,
|
||||
"top": 228,
|
||||
"width": 209,
|
||||
"height": 220,
|
||||
"css": "",
|
||||
"label": "plot (toggles)",
|
||||
"points": "multitoggle_1",
|
||||
"rangeX": {
|
||||
"min": 0,
|
||||
"max": 1
|
||||
},
|
||||
"rangeY": {
|
||||
"min": 0,
|
||||
"max": 1
|
||||
},
|
||||
"logScaleX": false,
|
||||
"logScaleY": false,
|
||||
"id": "plot_4"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue