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

@ -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})
})
}
}