Created
January 16, 2017 14:27
-
-
Save RitaDias/2044319de1ce8297d9ddee732466a6a4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function onTouchStart(evt) { | |
| startTime = new Date().getTime(); | |
| startX = evt.touches[0].pageX; | |
| startY = evt.touches[0].pageY; | |
| touchingElement = true; | |
| touchStart(startX, startY); | |
| } | |
| function onTouchMove(evt) { | |
| if (!touchingElement) | |
| return; | |
| currentX = evt.touches[0].pageX; | |
| currentY = evt.touches[0].pageY; | |
| const translateX = currentX - startX; // distance moved in the x axis | |
| const translateY = currentY - startY; // distance moved in the y axis | |
| touchMove(evt, currentX, currentY, translateX, translateY); | |
| } | |
| function onTouchEnd(evt) { | |
| if (!touchingElement) | |
| return; | |
| touchingElement = false; | |
| const translateX = currentX - startX; // distance moved in the x axis | |
| const translateY = currentY - startY; // distance moved in the y axis | |
| const timeTaken = (new Date().getTime() - startTime); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment