xy/multixy: add auto choice to to axisLock (locks on the first moved axis)
This commit is contained in:
parent
a8a49d4e4e
commit
0f60d212fa
3 changed files with 5 additions and 4 deletions
|
|
@ -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.'
|
||||
]},
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue