pads: clean address splitting api
This commit is contained in:
parent
999febcb99
commit
1d01b47efb
4 changed files with 8 additions and 8 deletions
|
|
@ -47,7 +47,7 @@ Pads are multidimensional widgets that output multiple values.
|
|||
- default: `false`
|
||||
- usage:
|
||||
- set to `true` to send separate osc messages for `x` and `y` axis. The `address` will be the same as the widget's with `/x` or `/y` appended to it
|
||||
- can be set as an object to specify a different `address` : `{x:'/osc_address_x', y:'/osc_address_y'}`
|
||||
- can be set as an object to specify a different `address` : `['/osc_address_x', '/osc_address_y']`
|
||||
- note: the widget will only respond to its original osc address, not to the splitted version
|
||||
|
||||
----
|
||||
|
|
@ -99,7 +99,7 @@ Pads are multidimensional widgets that output multiple values.
|
|||
- default: `false`
|
||||
- usage:
|
||||
- set to `true` to send separate osc messages for each point's `x` and `y` axis. The `address` will be the same as the widget's with `/N/x` or `/N/y` appended to it, where `N` is the point's id.
|
||||
- can be set as an object to specify a different `address` : `{0:'/osc_address/0', 1:'/osc_address_/1'}` (each address will be appended `/x` or `y`)
|
||||
- can be set as an object to specify a different `address` : `['/0/x', '/0/y', '/1/x', '/2/y']`
|
||||
- note: the widget will only respond to its original osc address, not to the splitted version
|
||||
|
||||
#### `snap`
|
||||
|
|
@ -134,4 +134,4 @@ RGB is a variant of XY, it outputs rgb values between 0 and 255.
|
|||
- default: `false`
|
||||
- usage:
|
||||
- set to `true` to send separate osc messages for `r` and `g` & `b`. The `address` will be the same as the widget's with `/r`, `/g` or `/b` appended to it
|
||||
- can be set as an object to specify a different `address` : `{r:'/osc_address_r', g:'/osc_address_g',b:'/osc_address_b'}`
|
||||
- can be set as an object to specify a different `address` : `['/r', '/b', '/b']`
|
||||
|
|
|
|||
|
|
@ -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={};
|
||||
|
|
|
|||
|
|
@ -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(`
|
||||
|
|
|
|||
|
|
@ -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(`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue