fix: Stop throwing error when PointerEvent.pageX is 0. (#5727)

The e.pageX (and .pageY) checks aren't strict enough.  0 is a perfectly valid coordinate.

Checking for the existence of changedTouches is an easier way to distinguish a PointerEvent from a TouchEvent.
This commit is contained in:
Neil Fraser
2021-11-26 10:27:43 -08:00
committed by GitHub
parent da3df70f6f
commit 1a470003fe

View File

@@ -323,8 +323,8 @@ TouchGesture.prototype.getTouchPoint = function(e) {
return null;
}
return new Coordinate(
(e.pageX ? e.pageX : e.changedTouches[0].pageX),
(e.pageY ? e.pageY : e.changedTouches[0].pageY));
(e.changedTouches ? e.changedTouches[0].pageX : e.pageX),
(e.changedTouches ? e.changedTouches[0].pageY : e.pageY));
};
exports.TouchGesture = TouchGesture;