patchbay: trigger onValue script when a connection changes

This commit is contained in:
bordun 2022-06-01 14:28:52 +02:00
parent 34602bc45e
commit 60877f86ae
3 changed files with 17 additions and 2 deletions

View file

@ -5,6 +5,9 @@
- bug fixes
- modal: display issue when a modal receives the same value mutliple times
- widgets
- patchbay: trigger `onValue` script when a connection changes
- misc
- windows: allow accessing other drives than the default one (list drives when the file browser reaches the filesystem's root)

View file

@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
"version": "1.16.3",
"version": "1.16.4",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"

View file

@ -133,6 +133,7 @@ class PatchBay extends Container(Canvas) {
this.inputNodes = []
this.outputNodes = []
this.value = {}
for (let k in this.inputs) {
let w = parser.parse({
@ -144,7 +145,6 @@ class PatchBay extends Container(Canvas) {
preArgs: this.inputs[k],
bypass: '@{parent.bypass}',
label: k
},
parentNode: DOM.get(this.widget, '.inputs')[0],
parent: this
@ -153,6 +153,7 @@ class PatchBay extends Container(Canvas) {
w._not_editable = true
this.inputsWidgets.push(w)
this.inputNodes.push(w.container)
this.value[k] = []
}
var outputs = DOM.get(this.widget, '.outputs')[0]
@ -196,6 +197,17 @@ class PatchBay extends Container(Canvas) {
}, {element: this.widget})
this.on('value-changed',(e)=>{
if (e.widget === this || e.widget.parent !== this) return
var k = e.widget.getProp('label')
this.value[k] = e.widget.getValue()
this.changed(e.options)
})
}
toggleConnection(node) {