toggle: make doubletap exclusive

This commit is contained in:
jean-emmanuel 2017-08-17 23:52:46 +02:00
parent 706951371e
commit cb5b024511

View file

@ -49,15 +49,8 @@ module.exports = class Toggle extends _widgets_base {
this.widget.value = this.widget.find('span')
this.widget.state = 0
this.widget.on('drag',(e)=>{e.stopPropagation()})
this.widget.on('draginit.toggle',()=>{
this.widget.off('draginit.toggle')
this.fakeclick()
})
if (this.getProp('led')) this.container.addClass('led')
if (this.getProp('doubleTap')) {
doubletab(this.widget, ()=>{
@ -65,6 +58,14 @@ module.exports = class Toggle extends _widgets_base {
this.setValue(newVal,{sync:true,send:true})
})
} else {
// this.widget.on('drag',(e)=>{e.stopPropagation()})
this.widget.on('draginit.toggle',()=>{
this.widget.off('draginit.toggle')
this.fakeclick()
})
}
this.classHolders = this.widget.add(this.container)