Skip to content

Commit

Permalink
fix(pointer-events): listening to document
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Aug 1, 2018
1 parent 4fcab89 commit afb0906
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/src/utils/gesture/pointer-events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ export class PointerEvents {
return;
}
if (!this.rmMouseMove && this.pointerMove) {
this.rmMouseMove = addEventListener(this.el.ownerDocument, 'mousemove', this.pointerMove, this.options);
this.rmMouseMove = addEventListener(getDocument(this.el), 'mousemove', this.pointerMove, this.options);
}
if (!this.rmMouseUp) {
this.rmMouseUp = addEventListener(this.el.ownerDocument, 'mouseup', this.bindMouseUp, this.options);
this.rmMouseUp = addEventListener(getDocument(this.el), 'mouseup', this.bindMouseUp, this.options);
}
}

Expand Down Expand Up @@ -130,6 +130,10 @@ export class PointerEvents {
}
}

function getDocument(node: Node) {
return node instanceof Document ? node : node.ownerDocument;
}

export const POINTER_EVENT_TYPE_MOUSE = 1;
export const POINTER_EVENT_TYPE_TOUCH = 2;

Expand Down

0 comments on commit afb0906

Please sign in to comment.