Skip to content
Browse files

Add deltaX/Y to touch events as well (pointermove/drag)

  • Loading branch information...
1 parent daaac99 commit 5042e78bacc978b52102e0896590dc765293679b @davidaurelio davidaurelio committed Feb 22, 2013
Showing with 7 additions and 0 deletions.
  1. +7 −0 src/renderer/svg/svg_event_handlers.js
View
7 src/renderer/svg/svg_event_handlers.js
@@ -85,6 +85,8 @@ define([
case 'touchmove':
event.diffX = clientX - touchData.startX;
event.diffY = clientY - touchData.startY;
+ event.deltaX = clientX - touchData.lastX;
+ event.deltaY = clientY - touchData.lastY;
touchData.touchMoveHappened = true;
event = cloneBasicEvent(event);
event.type = prefix + 'drag';
@@ -107,6 +109,7 @@ define([
event.type = 'click';
this.emit('userevent', event, targetId);
}
+ break;
}
},
@@ -136,6 +139,10 @@ define([
if (i === 0) {
this.handleSingleTouch(touch, singleTouchData, false);
}
+
+ // set lastX/Y at the very end -- touches might be handled to handleSingleTouch multiple times
+ singleTouchData.lastX = touch.clientX;
+ singleTouchData.lastY = touch.clientY;
}
}

0 comments on commit 5042e78

Please sign in to comment.
Something went wrong with that request. Please try again.