Created
December 7, 2016 08:13
-
-
Save philippgerbig/5a54702efb8483325db2f2a038584602 to your computer and use it in GitHub Desktop.
get touch point position
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 getMouseTouchPointPosition( e ) { | |
| var result = { | |
| x : 0, | |
| y : 0 | |
| }; | |
| if (e.originalEvent.touches) { | |
| var touches = e.originalEvent.touches; | |
| if (touches.length > 0) { | |
| result.x = touches[0].pageX; | |
| result.y = touches[0].pageY; | |
| } | |
| } else { | |
| result.x = e.pageX; | |
| result.y = e.pageY; | |
| } | |
| return result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment