sliders/pads: holding Ctrl now enables high precision dragging with the mouse and bypasses the snap option

This commit is contained in:
jean-emmanuel 2017-12-22 13:16:56 +01:00
parent 56a05b61be
commit bdfe6f6bb9
6 changed files with 10 additions and 7 deletions

View file

@ -10,9 +10,9 @@
- downgraded to the latest *stable* electron release
- main
- added `zeroconf` / `bonjour` publishing for the app's http and osc input ports
- cli
- added `--instance-name` option to differenciate mulitple instances in zeroconf networks
- widgets
- sliders/pads: holding `Ctrl` now enables high precision dragging with the mouse and bypasses the `snap` option
- inputs: renamed `input`'s property `horizontal` to `vertical` to match how the widget actually displays
- sliders: **new** `range` widget
- plots: **new** `image` widget

View file

@ -30,4 +30,6 @@ See [Editing sessions](editing-sessions.md).
| Click | Tap | Handled at pressing time, not releasing. |
| Double Click | Double Tap | Some widgets handle double click / tap events. |
| Right-click | Long touch | Widgets that have only one value input will give focus to it when receiving this event. When the editor is enabled, Right-click / Long touch spawns the editor's context menu. |
| Drag | | The widgets respond to mouse and touch drag gestures with a 1:1 precision ratio. By using two or more fingers, one can obtain higher precision gestures : each finger that touches the widget without moving will slow down the moving one. |
| Drag | Drag | The widgets respond to mouse and touch drag gestures with a 1:1 precision ratio. |
| `Ctrl` + Drag | | Holding the `Ctrl` key while dragging with the mouse increases the gesture's precision by 8.|
| | Multi-finger drag (single target) | Using two or more fingers on a single-touch target increases the gesture's precision by the squared number of fingers. |

View file

@ -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()

View file

@ -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:

View file

@ -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

View file

@ -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)