sliders/xy: add support for doubleTap address (#174)

This commit is contained in:
jean-emmanuel 2018-03-03 14:38:48 +01:00
parent bf272c1fab
commit 021e06fd49
5 changed files with 36 additions and 12 deletions

View file

@ -17,6 +17,7 @@
- property inheritance: `@{widget_id.value}`, `@{widget_id}` and `@{widget_id._value}` now all refer to the widget's current value (the latter being kept for backward compatibility); If a property update triggers an osc message, it will now be sent after the other dynamic properties changes are resolved (such as osc `address`, `target`, etc)
- text: added `align` and `wrap` properties
- input: added `align` property
- sliders/xy: `doubleTap` can be an osc address to send a special message instead of resetting the widget's value
- editor
- allow selecting multiple widgets (`ctrl + click`) if they share the same parent. Context-menu and sidepanel editing actions apply to all selected widgets

View file

@ -52,9 +52,10 @@ Pads are multidimensional widgets that output multiple values.
- usage: when set to `true`, the widget will go back to its `default` value when released.
### `doubleTap`
- type: `boolean`
- type: `boolean|string`
- default: `false`
- usage: set to `true` to make the xy reset to its `default` value when receiving a double tap
- usage: set to `true` to make the fader reset to its `default` value when receiving a double tap. `doubleTap` can also be an osc address, which case the widget will just send an osc message (`/<doubleTap> <preArgs>`),
### `split`
- type: `boolean|object`

View file

@ -86,9 +86,9 @@ range: {
### `doubleTap`
- type: `boolean`
- type: `boolean|string`
- default: `false`
- usage: set to `true` to make the fader reset to its `default` value when receiving a double tap
- usage: set to `true` to make the fader reset to its `default` value when receiving a double tap. `doubleTap` can also be an osc address, which case the widget will just send an osc message (`/<doubleTap> <preArgs>`),
### `meter`
- type: `boolean`

View file

@ -144,11 +144,23 @@ module.exports = class Xy extends Pad {
}, {element: this.wrapper})
if (this.getProp('doubleTap')) {
doubletab(this.wrapper, ()=>{
this.faders.x.setValue(this.faders.x.springValue, {sync: false, send:false, dragged:true})
this.faders.y.setValue(this.faders.y.springValue, {sync: false, send:false, dragged:true})
this.setValue([this.faders.x.springValue,this.faders.y.springValue],{sync:true, send:true})
})
if (typeof this.getProp('doubleTap') === 'string' && this.getProp('doubleTap')[0] === '/') {
doubletab(this.widget, ()=>{
this.sendValue({v:null, address: this.getProp('doubleTap')})
})
} else {
doubletab(this.wrapper, ()=>{
this.faders.x.setValue(this.faders.x.springValue, {sync: false, send:false, dragged:true})
this.faders.y.setValue(this.faders.y.springValue, {sync: false, send:false, dragged:true})
this.setValue([this.faders.x.springValue,this.faders.y.springValue],{sync:true, send:true})
})
}
}
if (this.getProp('input')) {

View file

@ -54,9 +54,19 @@ class Slider extends Canvas {
if (this.getProp('doubleTap')) {
doubletab(this.widget, ()=>{
this.setValue(this.springValue,{sync:true, send:true, fromLocal:true})
})
if (typeof this.getProp('doubleTap') === 'string' && this.getProp('doubleTap')[0] === '/') {
doubletab(this.widget, ()=>{
this.sendValue({v:null, address: this.getProp('doubleTap')})
})
} else {
doubletab(this.widget, ()=>{
this.setValue(this.springValue,{sync:true, send:true, fromLocal:true})
})
}
}