doubleTap: make it optionnal for pads/sliders

This commit is contained in:
jean-emmanuel 2017-06-14 23:04:52 +02:00
parent 9abd6c7678
commit 5a90643dc8
8 changed files with 49 additions and 18 deletions

View file

@ -13,7 +13,7 @@ Sessions saved with this version will not be readable with older versions (old s
- panel: added full osc support (for sending/receiving tab changes)
- modal: changed style to fit popups' appearance; added `popupWidth` and `popupHeight` options; :warning: removed `tabs` option; added full osc support; added `doubleTap` option (makes it openable with double taps instead of single taps)
- strip: refactored widget using `panel` as base; added `stretch` and `spacing` option; now it's really cool
- sliders: added double tap support (resets the widget to its initial value)
- sliders: added `doubleTap` option (double taps reset the widget to its initial value when enabled)
- knob/fader: renamed `noPip` option to `pips` (inverted behaviour; backward compatible)
- encoder: mousewheel support
- knob: compact design remake

View file

@ -6,8 +6,6 @@ Pads are multidimensional widgets that output multiple values.
## XY
Xy reset to their initial value when receiving double tap / click events.
```js
{
type:'xy',
@ -49,6 +47,11 @@ Xy reset to their initial value when receiving double tap / click events.
- default: `false`
- usage: when set to `true`, the widget will go back to its initial value when released.
#### `doubleTap`
- type: `boolean`
- default: `false`
- usage: set to `true` to make the xy reset to its initial value when receiving a double tap
#### `split`
- type: `boolean|object`
- default: `false`

View file

@ -1,7 +1,6 @@
# Sliders
Sliders are unidimensional widgets that output one value at a time. They reset to their initial value when receiving double tap / click events.
Sliders are unidimensional widgets that output one value at a time.
----
@ -76,6 +75,12 @@ range: {
- default: `false`
- usage: when set to `true`, the widget will go back to its initial value when released.
#### `doubleTap`
- type: `boolean`
- default: `false`
- usage: set to `true` to make the fader reset to its initial value when receiving a double tap
#### `meter`
- type: `boolean`
- default: `false`
@ -164,6 +169,11 @@ range: {
- default: `false`
- usage: when set to `true`, the widget will go back to its initial value when released.
#### `doubleTap`
- type: `boolean`
- default: `false`
- usage: set to `true` to make the knob reset to its initial value when receiving a double tap
#### `css`
```
--color-gauge:color;
@ -212,6 +222,10 @@ An endless knob that only responds to rotative gestures.
- default: `false`
- usage: by default, dragging the widget will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position.
#### `doubleTap`
- type: `boolean`
- default: `false`
- usage: set to `true` to make the encoder reset to its initial value when receiving a double tap
#### `css`
```

View file

@ -28,6 +28,7 @@ module.exports = class Xy extends _pads_base {
snap:false,
spring:false,
doubleTap:false,
_osc:'osc',
@ -129,9 +130,11 @@ module.exports = class Xy extends _pads_base {
})
}
doubletabreset(this.wrapper, ()=>{
this.setValue([this.faders.x.springValue,this.faders.y.springValue],{sync:true, send:true, fromLocal:true})
})
if (this.getProp('doubleTap')) {
doubletabreset(this.wrapper, ()=>{
this.setValue([this.faders.x.springValue,this.faders.y.springValue],{sync:true, send:true, fromLocal:true})
})
}
this.faders.x.input.change(()=>{
var v = [this.faders.x.value, this.faders.y.value]

View file

@ -52,9 +52,13 @@ module.exports = class _sliders_base extends _canvas_base {
this.springValue = this.getProp('value') !== '' ? this.getProp('value') :  this.originValue
doubletabreset(this.widget, ()=>{
this.setValue(this.springValue,{sync:true, send:true, fromLocal:true})
})
if (this.getProp('doubleTap')) {
doubletabreset(this.widget, ()=>{
this.setValue(this.springValue,{sync:true, send:true, fromLocal:true})
})
}
this.widget.on('fake-right-click',function(e){
if (!EDITING) {

View file

@ -49,6 +49,7 @@ module.exports = class Encoder extends _widgets_base {
_behaviour:'behaviour',
snap:false,
doubleTap:false,
_osc:'osc',
@ -151,13 +152,17 @@ module.exports = class Encoder extends _widgets_base {
})
})
doubletabreset(this.wrapper, ()=>{
this.knob.setValue(this.ticks/2)
this.display.setValue(this.ticks/2)
if (this.getProp('release') !== '' && this.value !== this.getProp('release')) {
this.setValue(this.getProp('release'), {sync:true, send:true, dragged:false})
}
})
if (this.getProp('doubleTap')) {
doubletabreset(this.wrapper, ()=>{
this.knob.setValue(this.ticks/2)
this.display.setValue(this.ticks/2)
if (this.getProp('release') !== '' && this.value !== this.getProp('release')) {
this.setValue(this.getProp('release'), {sync:true, send:true, dragged:false})
}
})
}
this.wrapper.on('mousewheel', (e)=>{

View file

@ -30,6 +30,7 @@ module.exports = class Fader extends _sliders_base {
snap:false,
spring:false,
doubleTap:false,
_osc:'osc',

View file

@ -28,6 +28,7 @@ module.exports = class Knob extends _sliders_base {
snap:false,
spring:false,
doubleTap:false,
_osc:'osc',