Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

touchTargets undefined on touchend/touchleave #22

Open
x68507 opened this issue Apr 10, 2014 · 2 comments
Open

touchTargets undefined on touchend/touchleave #22

x68507 opened this issue Apr 10, 2014 · 2 comments

Comments

@x68507
Copy link

x68507 commented Apr 10, 2014

When drawing on a canvas on a mobile device, there is an error "Uncaught TypeError: Cannot read property 'pageX' of undefined" on the touchend/touchleave bound to the canvas. The script is trying to call "e.originalEvent.targetTouches[0].pageX;", but it appears that on the touchend/touchleave event, "e.originalEvent.targetTouches[0]" is not defined, causing an error and resetting the entire canvas on mobile. You can simply encase the .pageX and .pageY lines in an if statement checking if both .targetTouches[0] and .targetTouche[0].pageX are defined. See any below:

http://stackoverflow.com/questions/21311073/sketch-js-pagex-undefined-error/22976319#22976319

@Rudloff
Copy link

Rudloff commented Jun 4, 2014

This can be easily fixed like this: https://gist.github.com/Rudloff/cdc38001248b5f35551f

@lenichols
Copy link

This fix worked for me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants