Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

ngTouch event coordinates should not report incorrect values #5565

Closed
MrHash opened this issue Dec 29, 2013 · 3 comments
Closed

ngTouch event coordinates should not report incorrect values #5565

MrHash opened this issue Dec 29, 2013 · 3 comments

Comments

@MrHash
Copy link

MrHash commented Dec 29, 2013

ClientX and ClientY click event values are not reported correctly on device browsers e.g. iOS6/Android, but works correctly on desktop browsers.

Please see demonstration http://plnkr.co/edit/9mSIhXrSbehfkirx359U?p=preview and test on mobile Safari/Chrome. Clicking inside the element returns incorrect values while clicking outside returns correct results.

This most likely covers the problem raised in issue #4428.

@ghost ghost assigned tbosch Jan 4, 2014
@tbosch
Copy link
Contributor

tbosch commented Jan 4, 2014

Right, we are using the touchstart event and forwarding it to the click handlers. However, touch events don't have clientX and clientY properties on the event but on the modified touches that are stored on the event.

@MrHash
Copy link
Author

MrHash commented Jan 5, 2014

OK the coords do seem to be available at event.changedTouches[0]. Is this the correct way to reference or does this remain a bug?

@tbosch
Copy link
Contributor

tbosch commented Jan 6, 2014

Yes, this is the correct way, see https://developer.mozilla.org/en-US/docs/Web/API/TouchEvent.changedTouches.

Actually, if you have two fingers down, you may want to have the coordinates of both of them in your event handler.
So keeping this under event.changedTouches makes sense!

Closing this as not an issue then!

@tbosch tbosch closed this as completed Jan 6, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants