fader: apply touchZone to doubleTap & (partially) mousewheel

This commit is contained in:
jean-emmanuel 2025-03-19 09:15:26 +01:00
parent be7d472414
commit 315f1de6c9
3 changed files with 16 additions and 4 deletions

View file

@ -4,6 +4,8 @@
- bug fixes
- eq: `highpass` filter not working as expected with `poles` set
- fader: `touchZone` not applied to `doubleTap` events
- fader: `touchZone` not affecting mousewheel interactions
## 1.28.0

View file

@ -125,6 +125,7 @@ class Fader extends Slider {
snap = this.getProp('snap')
if (zone == 'all') return true
if (e.type == 'wheel' && zone == 'knob') zone = 'gauge'
if (design == 'compact' && zone == 'gauge') return true
var x = e.offsetX,

View file

@ -57,14 +57,16 @@ class Slider extends Canvas {
if (typeof this.getProp('doubleTap') === 'string' && this.getProp('doubleTap')[0] === '/') {
doubleTap(this, ()=>{
doubleTap(this, (e)=>{
if (!this.shouldDrag(e)) return
this.sendValue({v:null, address: this.getProp('doubleTap')})
}, {element: this.widget})
}
if (this.getProp('doubleTap') == 'script') {
doubleTap(this, ()=>{
doubleTap(this, (e)=>{
if (!this.shouldDrag(e)) return
this.scripts.onTouch.run({
event: {type: 'doubleTap'},
value: this.value
@ -74,7 +76,8 @@ class Slider extends Canvas {
} else {
doubleTap(this, ()=>{
doubleTap(this, (e)=>{
if (!this.shouldDrag(e)) return
this.setValue(this.getSpringValue(),{sync:true, send:true, fromLocal:true, doubleTap:true})
}, {element: this.widget})
@ -97,6 +100,12 @@ class Slider extends Canvas {
}
shouldDrag(e) {
return true
}
mousewheelHandleProxy() {
this.mousewheelHandle(...arguments)
@ -123,7 +132,7 @@ class Slider extends Canvas {
mousewheelHandle(e) {
if (e.deltaX || this.getProp('spring')) return
if (e.deltaX || this.getProp('spring') || !this.shouldDrag(e)) return
e.preventDefault()
e.stopPropagation()