mirror of https://github.com/luileito/jsketch.git
Normalize finger IDs
This commit is contained in:
parent
1e2c32d40d
commit
fb7758ec3d
|
|
@ -430,15 +430,16 @@
|
||||||
var touches = e.originalEvent.changedTouches;
|
var touches = e.originalEvent.changedTouches;
|
||||||
for (var i = 0; i < touches.length; i++) {
|
for (var i = 0; i < touches.length; i++) {
|
||||||
var touch = touches[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.type = e.type;
|
||||||
|
touch.identifier = i;
|
||||||
callback(touch);
|
callback(touch);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Track only the current finger.
|
// Track only the current finger.
|
||||||
var touch = e.originalEvent.touches[0];
|
var touch = e.originalEvent.touches[0];
|
||||||
// Add the type of event to the touch object.
|
|
||||||
touch.type = e.type;
|
touch.type = e.type;
|
||||||
|
touch.identifier = 0;
|
||||||
callback(touch);
|
callback(touch);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -439,15 +439,16 @@
|
||||||
var touches = e.changedTouches;
|
var touches = e.changedTouches;
|
||||||
for (var i = 0; i < touches.length; i++) {
|
for (var i = 0; i < touches.length; i++) {
|
||||||
var touch = touches[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.type = e.type;
|
||||||
|
touch.identifier = i;
|
||||||
callback(touch);
|
callback(touch);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Track only the current finger.
|
// Track only the current finger.
|
||||||
var touch = e.touches[0];
|
var touch = e.touches[0];
|
||||||
// Add the type of event to the touch object.
|
|
||||||
touch.type = e.type;
|
touch.type = e.type;
|
||||||
|
touch.identifier = 0;
|
||||||
callback(touch);
|
callback(touch);
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue