modal: use draginit as click handler (allows preventing touch event from parent container)
This commit is contained in:
parent
bfc1d182be
commit
84474499c7
1 changed files with 4 additions and 11 deletions
|
|
@ -93,10 +93,12 @@ class Modal extends Panel {
|
|||
|
||||
var closer = DOM.get(this.popup, '.closer')[0]
|
||||
|
||||
this.on('fast-click',(e)=>{
|
||||
this.on('draginit',(e)=>{
|
||||
if ((e.target === this.popup || e.target === closer) && this.value == 1) {
|
||||
e.detail.preventOriginalEvent = true
|
||||
this.setValue(0, {sync:true, send:true})
|
||||
} else if (!this.getProp('doubleTap') && e.target === this.toggle) {
|
||||
if (e.capturedByEditor === true) return
|
||||
this.setValue(1, {sync:true, send:true})
|
||||
}
|
||||
}, {element: this.container})
|
||||
|
||||
|
|
@ -104,17 +106,8 @@ class Modal extends Panel {
|
|||
doubleTap(this, ()=>{
|
||||
this.setValue(1, {sync:true, send:true})
|
||||
}, {element: this.toggle})
|
||||
} else {
|
||||
this.on('fast-click',(e)=>{
|
||||
if (e.capturedByEditor === true) return
|
||||
if (e.target === this.toggle) {
|
||||
e.detail.preventOriginalEvent = true
|
||||
this.setValue(1, {sync:true, send:true})
|
||||
}
|
||||
}, {element: this.container})
|
||||
}
|
||||
|
||||
|
||||
this.escapeKeyHandler = ((e)=>{
|
||||
if (e.key == 'Escape') this.setValue(0, {sync:true, send:true})
|
||||
}).bind(this)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue