From c4186b877f39480ed34aa9ffed4e6cbabbc61c30 Mon Sep 17 00:00:00 2001 From: WORMSS Date: Fri, 29 Aug 2014 01:49:14 +0100 Subject: [PATCH] Update wScratchPad.js jQuery appears to not populate the event with changedTouches when dealing with touchend event with android devices. This fix cuts jQuery out of the equation and you observe a fully populated touchend event. --- src/wScratchPad.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/wScratchPad.js b/src/wScratchPad.js index 649de29..ca423e2 100644 --- a/src/wScratchPad.js +++ b/src/wScratchPad.js @@ -285,7 +285,7 @@ }; $.fn.bindMobileEvents = function () { - $(this).on('touchstart touchmove touchend touchcancel', function (event) { + var eventFunc = function (event) { var touches = (event.changedTouches || event.originalEvent.targetTouches), first = touches[0], type = ''; @@ -315,5 +315,8 @@ first.target.dispatchEvent(simulatedEvent); }); + $(this).on('touchstart touchmove touchcancel', eventFunc).each(function () { + this.addEventListener('touchend', eventFunc); + }); }; -})(jQuery); \ No newline at end of file +})(jQuery);