touch/drag: reliably detect number of fingers on target and set speedfactor = n^2
This commit is contained in:
parent
7ec41c599a
commit
a051c41d1e
1 changed files with 7 additions and 1 deletions
|
|
@ -175,10 +175,16 @@
|
|||
for (i in oE.changedTouches) {
|
||||
if (isNaN(i)) continue
|
||||
|
||||
var nFingers = 0
|
||||
for (j in oE.touches) {
|
||||
if (oE.touches[j].target && oE.touches[j].target.isSameNode(oE.changedTouches[i].target)) {
|
||||
nFingers += 1
|
||||
}
|
||||
}
|
||||
|
||||
var touch = oE.changedTouches[i],
|
||||
id = touch.identifier,
|
||||
speedFactor = oE.targetTouches.length == 1 ? 1 : Math.pow(2,oE.targetTouches.length)
|
||||
speedFactor = nFingers * nFingers
|
||||
|
||||
if (e.originalEvent.traversing) {
|
||||
targets[id] = $(document.elementFromPoint(touch.clientX, touch.clientY))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue