jQTouch icon indicating copy to clipboard operation
jQTouch copied to clipboard

Tap event issuse in Android on scrolled pages

Open Farsad opened this issue 16 years ago • 1 comments

In 'handleTouch' function used clientX and clientY for startX and startY variables.

        startX = event.changedTouches[0].clientX,
        startY = event.changedTouches[0].clientY,

And in 'updateChanges' function used pageX and pageY to find deltaX and deltaY.

        function updateChanges() {
            var first = event.changedTouches[0] || null;
            deltaX = first.pageX - startX;
            deltaY = first.pageY - startY;
            deltaT = (new Date).getTime() - startTime;      
       }

clientX and clientY coordinates of touch relative to the viewport (excludes scroll offset) and pageX and pageY Relative to the full page (includes scrolling). On scrolled pages in the Iphone, clientY and pageY or clientX and pageX have same amounts! and jqtouch works correctly. But on the Android devices or emulator amounts of that property are different and when we click on an element deltaX or deltaY don't have zero amount and Tap function not work.

you must change clientX to pageX and clientY to PageY. I tested this solution on iphone and it works correctly on it too.

It was a big issue and I spent about two days to find it! :))

Farsad avatar Oct 13 '10 08:10 Farsad

Thanks for the fix! I've updated in my local repo and am testing. I'll push to public repo ASAP.

jonathanstark avatar Oct 13 '10 16:10 jonathanstark