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

Commit

Permalink
Suppress non-target boundary events on capture
Browse files Browse the repository at this point in the history
Fixes gh-177
Ref gh-195
  • Loading branch information
bethge authored and scottgonzalez committed Jan 7, 2016
1 parent 77e6921 commit 8e33953
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ var CLONE_DEFAULTS = [
0
];

var BOUNDARY_EVENTS = {
'pointerover': 1,
'pointerout': 1,
'pointerenter': 1,
'pointerleave': 1
};

var HAS_SVG_INSTANCE = (typeof SVGElementInstance !== 'undefined');

/**
Expand Down Expand Up @@ -299,10 +306,13 @@ var dispatcher = {
return eventCopy;
},
getTarget: function(inEvent) {

// if pointer capture is set, route all events for the specified pointerId
// to the capture target
return this.captureInfo[inEvent.pointerId] || inEvent._target;
var capture = this.captureInfo[inEvent.pointerId];
if (!capture) {
return inEvent._target;
}
if (inEvent._target === capture || !(inEvent.type in BOUNDARY_EVENTS)) {
return capture;
}
},
setCapture: function(inPointerId, inTarget) {
if (this.captureInfo[inPointerId]) {
Expand Down

0 comments on commit 8e33953

Please sign in to comment.