sliders/pads: doubleTap can now be "script", in which case onTouch will be called with event.type set to doubleTap
This commit is contained in:
parent
c829d87eae
commit
79e0eee721
6 changed files with 47 additions and 12 deletions
|
|
@ -44,9 +44,10 @@ module.exports = class MultiXy extends Pad {
|
|||
'Restrict movements to one of the axes only.',
|
||||
'When left empty, holding `Shift` while dragging will lock the pad according the first movement. `auto` will do the opposite.'
|
||||
]},
|
||||
doubleTap: {type: 'boolean|string', value: false, help: [
|
||||
'Set to `true` to make the fader reset to its default value when receiving a double tap.',
|
||||
'Can also be an osc address, which case the widget will just send an osc message: `/<doubleTap> <preArgs>`'
|
||||
doubleTap: {type: 'boolean|string', value: false, choices: [false, true, 'script'], help: [
|
||||
'Set to `true` to make the knob reset to its `default` value when receiving a double tap.',
|
||||
'Can be an osc address, in which case the widget will just send an osc message with no value (but `preArgs` included).',
|
||||
'If set to "script", `onTouch` will be called with `event.type` set to `doubleTap`. '
|
||||
]},
|
||||
sensitivity: {type: 'number', value: 1, help: 'Defines the pad\'s sensitivity when `snap` is `false` '},
|
||||
}
|
||||
|
|
@ -195,7 +196,16 @@ module.exports = class MultiXy extends Pad {
|
|||
}
|
||||
|
||||
var pad = this.pads[id]
|
||||
pad.setValue([pad.faders.x.getSpringValue(), pad.faders.y.getSpringValue()], { sync: true, send: true, spring: true, doubleTap: true })
|
||||
|
||||
if (this.getProp('doubleTap') == 'script') {
|
||||
this.scripts.onTouch.run({
|
||||
event: {type: 'doubleTap', handle: id},
|
||||
value: this.value
|
||||
}, {sync: true, send: true})
|
||||
} else {
|
||||
pad.setValue([pad.faders.x.getSpringValue(), pad.faders.y.getSpringValue()], { sync: true, send: true, spring: true, doubleTap: true })
|
||||
}
|
||||
|
||||
}, { element: this.widget})
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,9 +36,10 @@ module.exports = class Xy extends Pad {
|
|||
'Restrict movements to one of the axes only unless `Shift` is held.',
|
||||
'When left empty, holding `Shift` while dragging will lock the pad according the first movement. `auto` will do the opposite.'
|
||||
]},
|
||||
doubleTap: {type: 'boolean|string', value: false, help: [
|
||||
'Set to `true` to make the fader reset to its default value when receiving a double tap.',
|
||||
'Can also be an osc address, which case the widget will just send an osc message: `/<doubleTap> <preArgs>`'
|
||||
doubleTap: {type: 'boolean|string', value: false, choices: [false, true, 'script'], help: [
|
||||
'Set to `true` to make the knob reset to its `default` value when receiving a double tap.',
|
||||
'Can be an osc address, in which case the widget will just send an osc message with no value (but `preArgs` included).',
|
||||
'If set to "script", `onTouch` will be called with `event.type` set to `doubleTap`. '
|
||||
]},
|
||||
sensitivity: {type: 'number', value: 1, help: 'Defines the pad\'s sensitivity when `snap` is `false` '},
|
||||
}
|
||||
|
|
@ -143,6 +144,16 @@ module.exports = class Xy extends Pad {
|
|||
this.sendValue({v:null, address: this.getProp('doubleTap')})
|
||||
}, {element: this.widget})
|
||||
|
||||
} else if (this.getProp('doubleTap') == 'script') {
|
||||
|
||||
doubleTap(this, ()=>{
|
||||
this.scripts.onTouch.run({
|
||||
event: {type: 'doubleTap'},
|
||||
value: this.value
|
||||
}, {sync: true, send: true})
|
||||
}, {element: this.widget})
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
doubleTap(this, ()=>{
|
||||
|
|
|
|||
|
|
@ -38,9 +38,10 @@ class Fader extends Slider {
|
|||
'This setting is ignored in containers with `traversing` set to `true`'
|
||||
]},
|
||||
spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its `default` value when released'},
|
||||
doubleTap: {type: 'boolean', value: false, help: [
|
||||
'Set to `true` to make the fader reset to its `default` value when receiving a double tap.',
|
||||
'Can also be an osc address, in which case the widget will just send an osc message (`/<doubleTap> <preArgs>`)'
|
||||
doubleTap: {type: 'boolean|string', value: false, choices: [false, true, 'script'], help: [
|
||||
'Set to `true` to make the knob reset to its `default` value when receiving a double tap.',
|
||||
'Can be an osc address, in which case the widget will just send an osc message with no value (but `preArgs` included).',
|
||||
'If set to "script", `onTouch` will be called with `event.type` set to `doubleTap`. '
|
||||
]},
|
||||
range: {type: 'object', value: {min:0,max:1}, help: [
|
||||
'Defines the breakpoints of the fader\'s scale:',
|
||||
|
|
|
|||
|
|
@ -31,9 +31,10 @@ class Knob extends Slider {
|
|||
'- `snap-alt`: alternative snap mode that allow jumping from `range.min` to `range.max`. `sensitivity` is ignored with this mode.',
|
||||
]},
|
||||
spring: {type: 'boolean', value: false, help: 'When set to `true`, the widget will go back to its `default` value when released'},
|
||||
doubleTap: {type: 'boolean', value: false, help: [
|
||||
doubleTap: {type: 'boolean|string', value: false, choices: [false, true, 'script'], help: [
|
||||
'Set to `true` to make the knob reset to its `default` value when receiving a double tap.',
|
||||
'Can also be an osc address, in which case the widget will just send an osc message (`/<doubleTap> <preArgs>`)'
|
||||
'Can be an osc address, in which case the widget will just send an osc message with no value (but `preArgs` included).',
|
||||
'If set to "script", `onTouch` will be called with `event.type` set to `doubleTap`. '
|
||||
]},
|
||||
range: {type: 'object', value: {min:0,max:1}, help: [
|
||||
'Defines the breakpoints of the fader\'s scale:',
|
||||
|
|
|
|||
|
|
@ -61,6 +61,17 @@ class Slider extends Canvas {
|
|||
this.sendValue({v:null, address: this.getProp('doubleTap')})
|
||||
}, {element: this.widget})
|
||||
|
||||
}
|
||||
if (this.getProp('doubleTap') == 'script') {
|
||||
|
||||
doubleTap(this, ()=>{
|
||||
this.scripts.onTouch.run({
|
||||
event: {type: 'doubleTap'},
|
||||
value: this.value
|
||||
}, {sync: true, send: true})
|
||||
}, {element: this.widget})
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
doubleTap(this, ()=>{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue