fix multitouch support : use global variables to store touches

This commit is contained in:
jean-emmanuel 2016-06-05 17:36:08 +02:00
parent 3ce7e8e7b4
commit 0974e3e6b2
2 changed files with 20 additions and 10 deletions

View file

@ -4177,10 +4177,11 @@ require('./app')
// multi touch hanlder
window.targets = window.targets || {}
window.previousTouches = window.previousTouches || {}
window.touchActive = window.touchActive || false
var targets = {},
previousTouches = {},
self = this,
var self = this,
touchStartHandler = function(e){
e.preventDefault()
@ -4209,8 +4210,11 @@ require('./app')
}
$document.on(events.touch.move,touchMoveHandler)
$document.on(events.touch.stop,touchStopHandler)
if (!touchActive) {
$document.on(events.touch.move,touchMoveHandler)
$document.on(events.touch.stop,touchStopHandler)
touchActive = true
}
},
touchMoveHandler = function(e){
@ -4283,6 +4287,7 @@ require('./app')
if (oE.touches.length==0) {
$document.off(events.touch.move,touchMoveHandler)
$document.off(events.touch.stop,touchStopHandler)
touchActive = false
}
}

View file

@ -119,10 +119,11 @@
// multi touch hanlder
window.targets = window.targets || {}
window.previousTouches = window.previousTouches || {}
window.touchActive = window.touchActive || false
var targets = {},
previousTouches = {},
self = this,
var self = this,
touchStartHandler = function(e){
e.preventDefault()
@ -151,8 +152,11 @@
}
$document.on(events.touch.move,touchMoveHandler)
$document.on(events.touch.stop,touchStopHandler)
if (!touchActive) {
$document.on(events.touch.move,touchMoveHandler)
$document.on(events.touch.stop,touchStopHandler)
touchActive = true
}
},
touchMoveHandler = function(e){
@ -225,6 +229,7 @@
if (oE.touches.length==0) {
$document.off(events.touch.move,touchMoveHandler)
$document.off(events.touch.stop,touchStopHandler)
touchActive = false
}
}