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

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