fix(pointer-events): listening to document

This commit is contained in:
Manu Mtz.-Almeida
2018-08-01 19:08:56 +02:00
parent 4fcab89651
commit afb0906119

View File

@ -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);
}
}
@ -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;