mirror of https://github.com/luileito/jsketch.git
Fixed multitouch events
This commit is contained in:
parent
3d262306eb
commit
73673bd789
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue