touch: assign touch properties to previousTouch object to avoid modification (safari seems to reuse the same object and ends up writing in previousTouch when creating a new touch event) (issue #78)

This commit is contained in:
jean-emmanuel 2017-09-02 16:10:28 +02:00
parent 74fbd52c37
commit 777ae6370b
2 changed files with 35 additions and 2 deletions

View file

@ -143,7 +143,18 @@
}
targets[id] = $(touch.target)
previousTouches[id] = touch
previousTouches[id] = {
deltaX:touch.deltaX,
deltaY:touch.deltaY,
offsetX:touch.offsetX,
offsetY:touch.offsetY,
speedX:touch.speedX,
speedY:touch.speedY,
pageX:touch.pageX,
pageY:touch.pageY,
clientX:touch.clientX,
clientY:touch.clientY
}
touch.speedX = 0
touch.speedY = 0
@ -218,7 +229,18 @@
}
previousTouches[id] = touch
previousTouches[id] = {
deltaX:touch.deltaX,
deltaY:touch.deltaY,
offsetX:touch.offsetX,
offsetY:touch.offsetY,
speedX:touch.speedX,
speedY:touch.speedY,
pageX:touch.pageX,
pageY:touch.pageY,
clientX:touch.clientX,
clientY:touch.clientY
}
}