xy/multixy: add auto choice to to axisLock (locks on the first moved axis)

This commit is contained in:
jean-emmanuel 2025-03-10 09:00:45 +01:00
parent a8a49d4e4e
commit 0f60d212fa
3 changed files with 5 additions and 4 deletions

View file

@ -9,7 +9,8 @@
- fader: add `touchZone` property to allow restricting interaction to a part of the widget
- eq: add support for n-poles lowpass and highpass filters with the filter's `poles` property
- eq: adapt sampling frequency to the x-axis range
- xy/multixy: add `auto` choice to to `axisLock` (locks on the first moved axis)
## 1.27.5
- bug fixes

View file

@ -40,7 +40,7 @@ module.exports = class MultiXy extends Pad {
rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'},
logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis. Set to `-1` for exponential scale.'},
logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis. Set to `-1` for exponential scale.'},
axisLock: {type: 'string', value: '', choices: ['', 'x', 'y'], help: [
axisLock: {type: 'string', value: '', choices: ['', 'auto', 'x', 'y'], help: [
'Restrict movements to one of the axes only.',
'When left to the default value, holding `Shift` while dragging will lock the pad according the first movement.'
]},

View file

@ -32,7 +32,7 @@ module.exports = class Xy extends Pad {
rangeY: {type: 'object', value: {min:0,max:1}, help: 'Defines the min and max values for the y axis'},
logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis. Set to `-1` for exponential scale.'},
logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis. Set to `-1` for exponential scale.'},
axisLock: {type: 'string', value: '', choices: ['', 'x', 'y'], help: [
axisLock: {type: 'string', value: '', choices: ['', 'auto', 'x', 'y'], help: [
'Restrict movements to one of the axes only unless `Shift` is held.',
'When left to the default value, holding `Shift` while dragging will lock the pad according the first movement.'
]},
@ -107,7 +107,7 @@ module.exports = class Xy extends Pad {
this.on('drag',(e)=>{
var axis = this.getProp('axisLock')
if (axis !== '' && e.shiftKey) axis = ''
else if (e.shiftKey && axis === '') {
else if (e.shiftKey && axis === '' || !e.shiftKey && axis === 'auto') {
if (this.autoAxisLock === '') {
if (Math.abs(e.movementX) > Math.abs(e.movementY)) {
this.autoAxisLock = 'x'