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

Commit

Permalink
Dispatch lostpointercapture and gotpointercapture events with a point…
Browse files Browse the repository at this point in the history
…erId
  • Loading branch information
dfreedm committed Mar 18, 2014
1 parent 0a3118a commit ef02daa
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@
this.releaseCapture(this.captureInfo.id);
}
this.captureInfo = {id: inPointerId, target: inTarget};
var e = new PointerEvent('gotpointercapture', { bubbles: true });
var e = document.createEvent('Event');
e.initEvent('gotpointercapture', true, false);
e.pointerId = inPointerId;
this.implicitRelease = this.releaseCapture.bind(this, inPointerId);
document.addEventListener('pointerup', this.implicitRelease);
document.addEventListener('pointercancel', this.implicitRelease);
Expand All @@ -295,7 +297,9 @@
},
releaseCapture: function(inPointerId) {
if (this.captureInfo && this.captureInfo.id === inPointerId) {
var e = new PointerEvent('lostpointercapture', { bubbles: true });
var e = document.createEvent('Event');
e.initEvent('lostpointercapture', true, false);
e.pointerId = inPointerId;
var t = this.captureInfo.target;
this.captureInfo = null;
document.removeEventListener('pointerup', this.implicitRelease);
Expand Down

0 comments on commit ef02daa

Please sign in to comment.