fader/knob/xy/range/multixy: remove touchAddress property; expose touch state in script property (touchAddress usages will be converted automatically)

This commit is contained in:
bordun 2020-10-01 15:07:04 +02:00
parent a492904708
commit e95816c806
11 changed files with 70 additions and 69 deletions

View file

@ -211,6 +211,28 @@ var converters = [
}
}
},
{
version: '1.3.1',
widget: (data)=>{
switch (data.type) {
case 'fader':
case 'knob':
case 'xy':
case 'range':
case 'multixy':
if (data.touchAddress && String(data.touchAddress).length) {
let touchVal = data.type.match(/range|multixy/) ? 'touch[0], touch[1]' : 'touch',
originalScript = data.script ? ` else {\n // original script\n ${data.script}\n // -----------\n}` : ''
data.script = `\nif (touch !== undefined) {\n // generated automatically\n // from touchAddress\n send("${data.touchAddress}", ${touchVal})\n}${originalScript}`
}
break
}
}
}
]