ignore mouse events fired by simulated touch events
This commit is contained in:
parent
dcb39d6d43
commit
598cbd1099
4 changed files with 38 additions and 12 deletions
|
|
@ -37,6 +37,9 @@ var menu = function(e,actions,parent){
|
|||
$(`<div class="item">${label}</div>`).on(ev + '.editor',function(){
|
||||
var callback = actions[label]
|
||||
return function(e){
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if (e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
callback()
|
||||
$('.context-menu').remove()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,9 @@ var init = function(){
|
|||
|
||||
if (!EDITING) return
|
||||
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if (e.type=='mousedown' && e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
$('.context-menu').remove()
|
||||
|
||||
var target = $(e.target).is('.widget:not(.not-editable), .tab, [data-tab], #container')?
|
||||
|
|
|
|||
|
|
@ -389,6 +389,9 @@ var menu = function(e,actions,parent){
|
|||
$(`<div class="item">${label}</div>`).on(ev + '.editor',function(){
|
||||
var callback = actions[label]
|
||||
return function(e){
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if (e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
callback()
|
||||
$('.context-menu').remove()
|
||||
}
|
||||
|
|
@ -916,6 +919,9 @@ var init = function(){
|
|||
|
||||
if (!EDITING) return
|
||||
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if (e.type=='mousedown' && e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
$('.context-menu').remove()
|
||||
|
||||
var target = $(e.target).is('.widget:not(.not-editable), .tab, [data-tab], #container')?
|
||||
|
|
@ -4110,6 +4116,9 @@ require('./app')
|
|||
this.on(events.mouse.start,function(e){
|
||||
e.stopPropagation()
|
||||
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if (e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
if (e.button==2) {
|
||||
e.preventDefault()
|
||||
$(e.target).trigger('fake-right-click',e)
|
||||
|
|
@ -4153,6 +4162,9 @@ require('./app')
|
|||
$document.on(events.mouse.stop,function(e){
|
||||
e.stopPropagation()
|
||||
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if (e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
if (!isPointerDown) return
|
||||
|
||||
e.speedX = e.pageX - previousEvent.pageX
|
||||
|
|
@ -4321,12 +4333,13 @@ require('./app')
|
|||
|
||||
$document.handleDragging()
|
||||
|
||||
// if (events.touch) {
|
||||
// $document.on('mousedown',function(e){
|
||||
// console.log('ef')
|
||||
// if (e.toElement.tagName!='INPUT') return false
|
||||
// })
|
||||
// }
|
||||
// prevent mouse events to be fired when emulating touch with chrome
|
||||
$document.on('mousedown mouseup',function(e){
|
||||
if (e.originalEvent.sourceCapabilities.firesTouchEvents) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
}
|
||||
})
|
||||
|
||||
$document.on('contextmenu',function(){return false})
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@
|
|||
this.on(events.mouse.start,function(e){
|
||||
e.stopPropagation()
|
||||
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if (e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
if (e.button==2) {
|
||||
e.preventDefault()
|
||||
$(e.target).trigger('fake-right-click',e)
|
||||
|
|
@ -79,6 +82,9 @@
|
|||
$document.on(events.mouse.stop,function(e){
|
||||
e.stopPropagation()
|
||||
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
if (e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
|
||||
if (!isPointerDown) return
|
||||
|
||||
e.speedX = e.pageX - previousEvent.pageX
|
||||
|
|
@ -247,12 +253,13 @@
|
|||
|
||||
$document.handleDragging()
|
||||
|
||||
// if (events.touch) {
|
||||
// $document.on('mousedown',function(e){
|
||||
// console.log('ef')
|
||||
// if (e.toElement.tagName!='INPUT') return false
|
||||
// })
|
||||
// }
|
||||
// prevent mouse events to be fired when emulating touch with chrome
|
||||
$document.on('mousedown mouseup',function(e){
|
||||
if (e.originalEvent.sourceCapabilities.firesTouchEvents) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
}
|
||||
})
|
||||
|
||||
$document.on('contextmenu',function(){return false})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue