pads: clean address splitting api

This commit is contained in:
jean-emmanuel 2017-01-24 06:48:22 +01:00
parent 999febcb99
commit 1d01b47efb
4 changed files with 8 additions and 8 deletions

View file

@ -52,7 +52,7 @@ module.exports = class MultiXy extends _pads_base {
this.widget[0].style.setProperty("--point-size",this.pointSize + 'rem')
this.split = widgetData.split?
typeof widgetData.split == 'object'?
typeof widgetData.split == 'object' && widgetData.split.length == 2 * widgetData.points ?
widgetData.split
: (()=>{
var s={};

View file

@ -42,9 +42,9 @@ module.exports = class Rgb extends _pads_base {
super(...arguments)
this.split = widgetData.split?
typeof widgetData.split == 'object'?
typeof widgetData.split == 'object' && widgetData.split.length == 3 ?
widgetData.split
: {r: widgetData.address + '/r', g: widgetData.address + '/g', b: widgetData.address + '/b'}
: [widgetData.address + '/r', widgetData.address + '/g', widgetData.address + '/b']
: false
this.widget.append(`

View file

@ -47,9 +47,9 @@ module.exports = class Xy extends _pads_base {
super(...arguments)
this.split = widgetData.split?
typeof widgetData.split == 'object'?
typeof widgetData.split == 'object' && widgetData.split.length == 2 ?
widgetData.split
: {x: widgetData.address + '/x', y: widgetData.address + '/y'}
: [widgetData.address + '/x', widgetData.address + '/y']
: false
this.widget.append(`