Ignore canceled touch events in taphold.js

Fixes #575
This commit is contained in:
fkloft 2013-09-24 13:47:01 +02:00
parent e504ee24ae
commit 1cecbe7f44

4
external/taphold.js vendored
View File

@ -106,12 +106,16 @@
$(this).bind((touchSupported ? "touchstart" : "mousedown"), data, startHandler) $(this).bind((touchSupported ? "touchstart" : "mousedown"), data, startHandler)
.bind((touchSupported ? "touchend" : "mouseup"), stopHandler) .bind((touchSupported ? "touchend" : "mouseup"), stopHandler)
.bind((touchSupported ? "touchmove" : "mouseleave"), leaveHandler); .bind((touchSupported ? "touchmove" : "mouseleave"), leaveHandler);
if(touchSupported)
$(this).bind("touchcancel", leaveHandler);
}, },
teardown: function(namespaces) teardown: function(namespaces)
{ {
$(this).unbind((touchSupported ? "touchstart" : "mousedown"), startHandler) $(this).unbind((touchSupported ? "touchstart" : "mousedown"), startHandler)
.unbind((touchSupported ? "touchend" : "mouseup"), stopHandler) .unbind((touchSupported ? "touchend" : "mouseup"), stopHandler)
.unbind((touchSupported ? "touchmove" : "mouseleave"), leaveHandler); .unbind((touchSupported ? "touchmove" : "mouseleave"), leaveHandler);
if(touchSupported)
$(this).bind("touchcancel", leaveHandler);
} }
}; };
})(jQuery); })(jQuery);