fader: fix touchZone == knob for compact design

This commit is contained in:
jean-emmanuel 2025-09-21 09:45:39 +02:00
parent 3f972838b0
commit de62a7ca0e
2 changed files with 11 additions and 3 deletions

View file

@ -6,6 +6,7 @@
- server: fix resolving absolute file urls containing the remote-root path
- prevent editor zoom level from affecting drag events when the editor is disabled
- prevent changing editor zoom level when it's disabled
- fader: fix touchZone == knob for compact design
- widgets
- the html property is no longer restricted / sanitized

View file

@ -136,10 +136,15 @@ class Fader extends Slider {
d = Math.round(this.percentToCoord(percent)),
m = horizontal ? this.height / 2 : this.width / 2,
knobHeight = this.cssVars.knobSize,
knobWidth = design ? knobHeight : knobHeight * .6
if (design == 'compact') knobWidth = this.width
knobWidth = knobHeight * .6,
height = !horizontal ? this.height : this.width
if (design == 'round') knobWidth = knobHeight
if (design == 'compact') {
knobWidth = this.width
// knob position range depends on knob size in compact mode
d = d / (height - this.gaugePadding) * (height-this.gaugePadding - knobHeight)
}
if (horizontal) [knobWidth, knobHeight] = [knobHeight, knobWidth]
// add extra tolerance pixels
@ -151,9 +156,11 @@ class Fader extends Slider {
condition
if (horizontal) {
if (design == 'compact') knobX += knobWidth / 2
condition = ((x >= knobX && x <= knobX + knobWidth) || (zone == 'gauge' || snap)) &&
y >= knobY && y <= knobY + knobHeight
} else {
if (design == 'compact') knobY += knobHeight / 2
condition = x >= knobX && x <= knobX + knobWidth &&
((y >= knobY && y <= knobY + knobHeight) || (zone == 'gauge' || snap))
}