mirror of
https://github.com/google/blockly.git
synced 2026-01-08 17:40:09 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user