From e9e51aaf0fd7afefc7dc4956656ae062b539f0eb Mon Sep 17 00:00:00 2001 From: Andrii Turyk Date: Mon, 15 Jul 2019 14:07:59 +0300 Subject: [PATCH] fix https://github.com/w3co/jcf/issues/73 --- js/jcf.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/js/jcf.js b/js/jcf.js index bb36fb4..160abeb 100755 --- a/js/jcf.js +++ b/js/jcf.js @@ -163,15 +163,13 @@ e.pointerType = origEvent.type.substr(0, 5); // "mouse" or "touch" word length } - if (!e.pageX && !e.pageY) { - touchEventData = origEvent.changedTouches ? origEvent.changedTouches[0] : origEvent; - e.pageX = touchEventData.pageX; - e.pageY = touchEventData.pageY; - } - - if (origEvent.type === 'touchend') { - lastTouch = { x: e.pageX, y: e.pageY }; - } + if (origEvent.type === 'touchend') { + touchEventData = origEvent.changedTouches ? origEvent.changedTouches[0] : origEvent; + e.pageX = touchEventData.pageX; + e.pageY = touchEventData.pageY; + lastTouch = { x: e.pageX, y: e.pageY }; + } + if (e.pointerType === 'mouse' && lastTouch && mouseEventSimulated(e)) { return; } else {