Normalize finger IDs

This commit is contained in:
Luis Leiva 2017-11-17 08:14:10 +01:00
parent 1e2c32d40d
commit fb7758ec3d
2 changed files with 6 additions and 4 deletions

View File

@ -430,15 +430,16 @@
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.
// Add event type and finger ID.
touch.type = e.type;
touch.identifier = i;
callback(touch);
}
} else {
// Track only the current finger.
var touch = e.originalEvent.touches[0];
// Add the type of event to the touch object.
touch.type = e.type;
touch.identifier = 0;
callback(touch);
}
};

View File

@ -439,15 +439,16 @@
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.
// Add event type and finger ID.
touch.type = e.type;
touch.identifier = i;
callback(touch);
}
} else {
// Track only the current finger.
var touch = e.touches[0];
// Add the type of event to the touch object.
touch.type = e.type;
touch.identifier = 0;
callback(touch);
}
e.preventDefault();