button: add client option altTraversing to allow one-way response to traversing gestures

This commit is contained in:
jean-emmanuel 2022-10-18 10:18:50 +02:00
parent d962c1efe0
commit e07322a520
4 changed files with 15 additions and 1 deletions

View file

@ -4,6 +4,7 @@
- widgets
- button: add `decoupled` property (restrict visual feedback to values received from osc/midi messages)
- button: add client option `altTraversing` to allow one-way response to traversing gestures
- canvas: iOS: trigger `onTouch` when `event.force`, `event.altitudeAngle` or `event.azimuthAngle` updates
- knob: add `snap-alt` mode (snap mode that allows jumping between range.min and range.max)
- all: add `borderRadius` property
@ -18,7 +19,8 @@
- on Mac, name virtual ports after the device name to avoid confusion
- server
- client-options: add `client-sync` option to allow disabling client synchronization
- client-options: add `clientSync` option to allow disabling client synchronization
- client-options: add `altTraversing` option
## 1.17.0

View file

@ -15,6 +15,7 @@ Client options can be set either with the server's `--client-options` option, or
| usePercents | 1 / 0 | 0 | sets the editor's "relative units" option |
| noFocus | 1 / 0 | 0 | (built-in client only) prevent the client window from taking focus unless a text input or a dropdown is clicked |
| clientSync | 1 / 0 | 1 | set to 0 to prevent the client from syncing with other clients |
| altTraversing | 1 / 0 | 0 | set to 1 to enable an alternative traversing behavior for toggle buttons (traversing gestures on toggle buttons will change their values in only one way depending on the first touched button's state) |
Example:

View file

@ -32,6 +32,9 @@ window.CLIENT_SYNC = parseInt(ENV.clientSync) === 0 ? 0 : 1
window.IOS_TOUCH_POLLING = false
window.TOGGLE_ALT_TRAVERSING = ENV.altTraversing ? true : false
window.JSON.parseFlex = require('json5').parse
window.DOM = require('./dom')

View file

@ -140,6 +140,14 @@ class Button extends Widget {
if (this.active) return
if (e.traversingStack && TOGGLE_ALT_TRAVERSING) {
if (e.traversingStack.firstButtonValue === undefined) {
e.traversingStack.firstButtonValue = this.state
} else if (e.traversingStack.firstButtonValue !== this.state) {
return
}
}
this.active = true
this.setValue(this.state ? this.getProp('off') : this.getProp('on'), {sync: true, send: true, y: e.offsetY, x: e.offsetX})