Permalink
Browse files

Handle touchcancel events

  • Loading branch information...
1 parent 6f46d8c commit 4296171e3ad6752a249d48af12b8d2ac3e96d145 @davidaurelio davidaurelio committed Feb 28, 2013
Showing with 4 additions and 2 deletions.
  1. +4 −2 src/renderer/svg/svg_event_handlers.js
@@ -156,6 +156,8 @@ define([
// event killing is needed to prevent native scrolling etc. within bonsai movies
domEvent.preventDefault();
}
+ } else if (domEventType === 'touchcancel') {
+ this._hadTouchCancel = true;
}
for (var i = 0; i < numTouches; i += 1) {
@@ -166,15 +168,15 @@ define([
}
if (domEventType === 'touchend' && domEvent.touches.length === 0) { // last finger is raised
- if (!(this._isMultiTouch || this._hadTouchMove)) {
+ if (!(this._isMultiTouch || this._hadTouchMove || this._hadTouchCancel)) {
var domTimeStamp = domEvent.timeStamp;
var isDoubleClick = domTimeStamp - (this._lastClickFromTouch || 0) < 300;
var clickType = isDoubleClick ? 'dblclick' : 'click';
this._lastClickFromTouch = isDoubleClick ? 0 : domTimeStamp;
emitMouseEvent(this, pointerEvent.clone(clickType), touchTargetId);
domEvent.preventDefault(); // prevent the default click
}
- this._isMultiTouch = false;
+ this._isMultiTouch = this._hadTouchCancel = false;
}
}
} else if (isKeyboardEventType(domEventType)) {

0 comments on commit 4296171

Please sign in to comment.