traversing: store traversing state in dom element

This commit is contained in:
jean-emmanuel 2018-10-23 09:34:49 +02:00
parent 0bf1c572ed
commit 93d0113b43
2 changed files with 10 additions and 6 deletions

View file

@ -269,6 +269,10 @@ module.exports = {
enableTraversingGestures: function(element, options={}) {
if (element._traversing) return
element._traversing = true
var traversing = options.smart ? TRAVERSING_SAMEWIDGET : true
function makeEventTraversing(event) {
@ -291,6 +295,10 @@ module.exports = {
disableTraversingGestures: function(element) {
if (!element._traversing) return
delete element._traversing
DOM.dispatchEvent(element, 'disableTraversingGestures')
}

View file

@ -62,13 +62,9 @@ module.exports = class Root extends Panel {
var traversing = this.getProp('traversing')
if (this._traversing) {
disableTraversingGestures(this.widget)
this._traversing = false
}
disableTraversingGestures(this.widget)
if (traversing && !this._traversing) {
this._traversing = true
if (traversing) {
enableTraversingGestures(this.widget, {smart: typeof traversing === 'string' && traversing.match(/smart|auto/)})
}