sliders/pads: holding Ctrl now enables high precision dragging with the mouse and bypasses the snap option
This commit is contained in:
parent
56a05b61be
commit
bdfe6f6bb9
6 changed files with 10 additions and 7 deletions
|
|
@ -96,7 +96,7 @@ module.exports = class Multifader extends _matrices_base {
|
|||
|
||||
}
|
||||
|
||||
if (this.getProp('traversing')) this.widget.enableTraversingGestures()
|
||||
if (this.getProp('traversing')) this.widget.enableTraversingGestures({ctrlKeyCancel:true})
|
||||
|
||||
this.registerHashes()
|
||||
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ module.exports = class Fader extends _sliders_base {
|
|||
|
||||
this.percent = clip(this.percent,[0,100])
|
||||
|
||||
if (!(traversing || this.getProp('snap'))) return
|
||||
if (!(traversing || this.getProp('snap')) || data.ctrlKey) return
|
||||
|
||||
this.percent = this.getProp('horizontal')?
|
||||
(data.offsetX - this.margin * PXSCALE) / (this.width - (this.margin * PXSCALE * 2)) * 100:
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ module.exports = class Knob extends _sliders_base {
|
|||
this.lastOffsetX = data.offsetX
|
||||
this.lastOffsetY = data.offsetY
|
||||
|
||||
if (!(traversing || this.getProp('snap'))) return
|
||||
if (!(traversing || this.getProp('snap')) || data.ctrlKey) return
|
||||
|
||||
this.percent = this.angleToPercent(this.coordsToAngle(data.offsetX, data.offsetY))
|
||||
|
||||
|
|
@ -86,7 +86,7 @@ module.exports = class Knob extends _sliders_base {
|
|||
|
||||
dragHandle(e, data, traversing) {
|
||||
|
||||
if (!(traversing || this.getProp('snap'))) {
|
||||
if (!(traversing || this.getProp('snap')) || data.ctrlKey) {
|
||||
|
||||
this.percent = -100*data.speedY/this.height + this.percent
|
||||
|
||||
|
|
|
|||
|
|
@ -297,11 +297,12 @@
|
|||
}
|
||||
|
||||
|
||||
$.fn.enableTraversingGestures = function() {
|
||||
$.fn.enableTraversingGestures = function(options={}) {
|
||||
|
||||
var self = this[0]
|
||||
|
||||
var down = function(e){
|
||||
if (e.ctrlKey && options.ctrlKeyCancel) return
|
||||
makeEventTraversing(e)
|
||||
self.addEventListener("mousemove", makeEventTraversing, true)
|
||||
self.addEventListener("touchmove", makeEventTraversing, true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue