Avoid the 'divide by zero' problem in bindMobileTouchHandler.
This commit is contained in:
parent
aa0b57c51d
commit
fa51f455fe
@ -462,9 +462,13 @@
|
|||||||
startCoords = currentCoords;
|
startCoords = currentCoords;
|
||||||
|
|
||||||
var currentTime = (new Date()).getTime();
|
var currentTime = (new Date()).getTime();
|
||||||
speed.x = differenceX / (currentTime - startTime);
|
|
||||||
speed.y = differenceY / (currentTime - startTime);
|
var timeGap = currentTime - startTime;
|
||||||
startTime = currentTime;
|
if (timeGap > 0) {
|
||||||
|
speed.x = differenceX / timeGap;
|
||||||
|
speed.y = differenceY / timeGap;
|
||||||
|
startTime = currentTime;
|
||||||
|
}
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user