Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
No need to target find on the touchstart
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreedm committed Mar 21, 2014
1 parent 52df041 commit bd19544
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/touch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
(function(scope) {
var dispatcher = scope.dispatcher;
var captureInfo = dispatcher.captureInfo;
var findTarget = scope.findTarget;
var allShadows = scope.targetFinding.allShadows.bind(scope.targetFinding);
var pointermap = dispatcher.pointermap;
var touchMap = Array.prototype.map.call.bind(Array.prototype.map);
Expand Down Expand Up @@ -144,18 +143,23 @@
}
return ret;
},
findTarget: function(ev) {
if (this.currentTouchEvent.type === 'touchstart') {
return this.currentTouchEvent.target;
}
return scope.findTarget(ev);
},
touchToPointer: function(inTouch) {
var cte = this.currentTouchEvent;
var e = dispatcher.cloneEvent(inTouch);
// Spec specifies that pointerId 1 is reserved for Mouse.
// Touch identifiers can start at 0.
// Add 2 to the touch identifier for compatibility.
var id = e.pointerId = inTouch.identifier + 2;
e.target = captureInfo[id] || findTarget(e);
e.target = captureInfo[id] || this.findTarget(e);
e.bubbles = true;
e.cancelable = true;
e.detail = this.clickCount;
e.button = 0;
e.buttons = this.typeToButtons(cte.type);
e.width = inTouch.webkitRadiusX || inTouch.radiusX || 0;
e.height = inTouch.webkitRadiusY || inTouch.radiusY || 0;
Expand Down

0 comments on commit bd19544

Please sign in to comment.