Fixed multitouch events

This commit is contained in:
Luis Leiva 2017-11-12 20:03:52 +01:00
parent 3d262306eb
commit 73673bd789
2 changed files with 8 additions and 4 deletions

View File

@ -408,8 +408,9 @@
*/
function execTouchEvent(e, callback) {
var elem = $(e.target), data = elem.data(namespace), options = data.options;
var touches = e.originalEvent.touches;
if (options.multitouch) {
// Track all fingers.
var touches = e.originalEvent.changedTouches;
for (var i = 0; i < touches.length; i++) {
var touch = touches[i];
// Add the type of event to the touch object.
@ -417,7 +418,8 @@
callback(touch);
}
} else {
var touch = touches[0];
// Track only the current finger.
var touch = e.originalEvent.touches[0];
// Add the type of event to the touch object.
touch.type = e.type;
callback(touch);

View File

@ -411,8 +411,9 @@
*/
function execTouchEvent(e, callback) {
var elem = e.target, data = dataBind(elem)[namespace], options = data.options;
var touches = e.touches;
if (options.multitouch) {
// Track all fingers.
var touches = e.changedTouches;
for (var i = 0; i < touches.length; i++) {
var touch = touches[i];
// Add the type of event to the touch object.
@ -420,7 +421,8 @@
callback(touch);
}
} else {
var touch = touches[0];
// Track only the current finger.
var touch = e.touches[0];
// Add the type of event to the touch object.
touch.type = e.type;
callback(touch);