switch: fix traversing + touch (#503)

This commit is contained in:
jean-emmanuel 2019-04-07 19:12:41 +02:00
parent d657665210
commit 1328fba53f
2 changed files with 10 additions and 2 deletions

View file

@ -4,6 +4,7 @@
- bug fixes
- sessions not added to history when opened
- switch: traversing mode issue
- widgets
- **removed** deprecated widgets `multifader`, `multitoggle`, `multipush` and `formula`
- new `JS{{}}` property syntax, allows writing formulas using javascript

View file

@ -62,11 +62,16 @@ module.exports = class Switch extends Widget {
this.value = undefined
var dragCallback = (e)=>{
var dragCallback = (e, touchFix)=>{
var index = 0,
node = e.target
if (touchFix && e.isTouch) {
// special traversing touch fix
node = document.elementFromPoint(e.clientX, e.clientY)
}
if (node === this.widget || !this.widget.contains(node)) return
while ( (node = node.previousSibling) ) {
@ -82,7 +87,9 @@ module.exports = class Switch extends Widget {
}
this.on('draginit', dragCallback , {element: this.widget})
if (this.getProp('traversing')) this.on('drag', dragCallback , {element: this.widget})
this.on('drag', (e)=>{
if (this.getProp('traversing') || e.traversing) dragCallback(e, true)
} , {element: this.widget})
}